This commit is contained in:
robert 2021-02-15 23:28:42 +01:00
parent c436d68a20
commit 192b0881bb
1 changed files with 2 additions and 2 deletions

View File

@ -50,7 +50,7 @@ while True:
print("temperature before cut: " + str(temperature)) print("temperature before cut: " + str(temperature))
# cut temperature to xx.xx if more then tow digits after "." # cut temperature to xx.xx if more then tow digits after "."
t_split = temperature.split(".") t_split = str(temperature).split(".")
if len(t_split[1]) > 2: if len(t_split[1]) > 2:
t_cut = len(t_split[1]) - 2 t_cut = len(t_split[1]) - 2
t_split[1] = t_split[1][:-t_cut] t_split[1] = t_split[1][:-t_cut]
@ -62,7 +62,7 @@ while True:
print("humidity before cut: " + str(humidity)) print("humidity before cut: " + str(humidity))
# cut humidity to xx.xx if more then tow digits after "." # cut humidity to xx.xx if more then tow digits after "."
h_split = humidity.split(".") h_split = str(humidity).split(".")
if len(h_split[1]) > 2: if len(h_split[1]) > 2:
h_cut = len(h_split[1]) - 2 h_cut = len(h_split[1]) - 2
h_split[1] = h_split[1][:-h_cut] h_split[1] = h_split[1][:-h_cut]