Python Code to Interface DHT11 sensor with Raspberry Pi

#DHT11 sensor measures both air temperature and moisture. Relative humidity is the ratio of
#actual moisture in the air to the highest amount of moisture air at that temperature can hold.
#DHT11 is connected to GPIO pin.
#Vcc->Pin1(3.3v)
#Gnd->Pin6(0v)
#Data->Pin15(GPIO22)

import dhtreader
import time
type = 11
pin = 04
dhtreader.init()
while True:
try:
temp, hum=dhtreader.read(type, pin)
except TypeError:
if temp and hum:
print dhtreader.read(type, pin)
print “Temp=”,temp,”*c”
print “Humidity=”, hum,”%”,”\n”
else:
print “No data”
time.sleep(2)