问题
I'm on Windows and I'm using PyScripter. For some reason everything results in a syntax error, even code that very obviously does not have a syntax error. For example,
print 6
gets a syntax error, as does,
a = 6
print a
list = (1, 2, 7, 3)
print list
print 3 + 3
or any other code I can think of that involves printing. Did I download Python wrong, am I setting it up wrong, or what?
回答1:
Are you using Python 3? The print function in Python three must use parentheses:
a = 6
print(a)
回答2:
I think you are installed python 3.x in your machine and writing python 2.x syntax in it. Try to install python 2.x or use python 3.x syntax while writing. :) Thank you
来源:https://stackoverflow.com/questions/17581532/python-syntax-error