Before each use of the object dht, add the statement import dht to the top of the Python file.
DHT11(): Object for the DHT11 sensor.DHT12(): Object for the DHT12 sensor.DHT11.measure(): Starts the DHT11 to measure temperature and humidity data once.DHT11.temperature(): Returns temperature data obtained by the DHT11.DHT11.humidity(): Returns humidity data obtained by the DHT11.DHT12.measure(): Starts the DHT12 to measure temperature and humidity data once.DHT12.temperature(): Returns temperature data obtained by the DHT12.DHT12.humidity(): Returns humidity data obtained by the DHT12.Adapted from Python_Tutorial.pdf — Chapter 24, Hygrothermograph DHT11