如何检查用户是否按下了ESCAPE?

时间:2017-04-29 03:45:21

标签: python

#greenhouse monitor algorithm
import msvcrt
while not (msvcrt.kbhit() and .....): #I want to check whether the key pressed is <ESCAPE> or not
    sensor1=float(input("Please input the temperature of the green house: ")) 
    sensor2=float(input("Please input the oxygen level of the green house: "))

    if (sensor1>45):
        print("Warning. Temperature is too high")

    if (sensor2<0.19):
        print("Warning. Oxygen level is too low")

如何检查按下的键是否为ESCAPE?

1 个答案:

答案 0 :(得分:0)