Python Syntax Error

2019-09-07 20:07发布

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?

2条回答
我想做一个坏孩纸
2楼-- · 2019-09-07 20:36

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

查看更多
别忘想泡老子
3楼-- · 2019-09-07 20:46

Are you using Python 3? The print function in Python three must use parentheses:

a = 6
print(a)
查看更多
登录 后发表回答