Python 3.1: Syntax Error for Everything! (Mac OS X)
I upd开发者_StackOverflow中文版ated to Python 3.1.3 (I've got OS X 10.6).
If I type python
in Terminal, I get a working 2.6.1 environment.
python3
in Terminal, I get a 3.1.3 environment. Everything looks fine until I do something. If I try to run print "hello"
, I get a syntax error.
This problem is the same in IDLE.
I tried deleting everything for 3.1 and then reinstalling, but it hasn't worked.
Ideas?
Thanks in advance!In Python 3.x, print
is a function, so use
print("Hello")
instead.
In Python 3, you need to use Print as a function:
print("Hello")
精彩评论