Coop Automation

print "Daylight {}".format(daylight)
^
SyntaxError: invalid syntax

(The ^ appears under the second")
I'm testing the code in Thonny running on a RPi Model 2 B ver 1.1 on Buster.
Any idea's why it's bombing out??
If your using Python3 the print statement is now a function so the syntax for print now is print('something or other') If your using Python 3.6 or newer then f strings can be used in the print function.
Code:
someVariable = 35
print(f'the value of someVariable is {someVariable}')
In the {} you can have variables or expressions.

JT
 

New posts New threads Active threads

Back
Top Bottom