fix error due to not process issues with temp detect

This commit is contained in:
usami 2025-03-14 11:04:27 +08:00
parent 03d231d5ca
commit a23f2c9989

View File

@ -30,10 +30,14 @@ isCelsius = False
if str(temp).__contains__("C"):
isCelsius = True
temp = float(temp.replace("C", ""))
if isCelsius:
temp = float(temp.replace("C", ""))
else:
temp = float(temp.replace("F", ""))
#转换成华氏度
if (isCelsius):
if isCelsius:
print("Fahrenheit should be " + str(temp * 1.8 + 32))
else:
print("Celsius should be " + str((temp - 32) / 1.8) )