Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 1579

Python • Re: Problem with print in a for loop.

$
0
0
It's more than that.
You need to give the full error code and nowaday it will also point to the errors. But that depends on the Python version you are using.
I believe the %s \n part is expecting one argument, and it is failing there (among other parts it would not work as expected.)
You should be using f-string in modern python coding.
E.G.
print(f"Temperature {row[1]}C Humidity {row[2]}% Date {row[3]}")

EDIT (and typos)
That's assuming row is also correct and is a list, tuple, etc.

Statistics: Posted by bensimmo — Mon Dec 15, 2025 12:44 pm



Viewing all articles
Browse latest Browse all 1579

Trending Articles