Python语法错误
问题描述:
我在Windows上并且正在使用PyScripter.由于某种原因,所有内容都会导致语法错误,即使代码很明显也没有语法错误.例如,
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
会得到语法错误,
a = 6
print a
list = (1, 2, 7, 3)
print list
print 3 + 3
或我能想到的任何其他涉及打印的代码.我是否错误地下载了Python,我将其设置错误还是什么?
or any other code I can think of that involves printing. Did I download Python wrong, am I setting it up wrong, or what?
答
您是否正在使用Python 3? Python三中的print函数必须使用括号:
Are you using Python 3? The print function in Python three must use parentheses:
a = 6
print(a)