Sep-27-2022, 10:32 AM
I'm a Python noob. I'm running Python 3.9.2 on a Raspberry Pi Zero W running Raspbian GNU/Linux 11 (bullseye) with a temperature and humidity sensor attached. I'm printing the data to the console and writing the same string to a file. The issue I am having is that the strings of readings print correctly to the console, but are written to the file vertically, one character per line, except that there is a single line where the last character from the first string is followed by the "T" from the second on the same line, but with that exception, every character appears on a line of its own. The code and output written to file are both attached. I'm obviously missing something very fundamental here and any help would be greatly appreciated.
The console output of two readings is:
Temp=73.0F Humidity=54.5%
Temp=74.5F Humidity=53.1%
The console output of two readings is:
Temp=73.0F Humidity=54.5%
Temp=74.5F Humidity=53.1%
Attached Files