-5

我有 centos 6.5
如果我输入 python,我会得到:

Python 3.3.2 (default, Oct 30 2013, 08:01:17) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux

我创建了一个文件 1.py :

print "Goodbye, World!"

python ./1.py
知道

  File "./1.py", line 1
    print "Goodbye, World!"
                          ^
SyntaxError: invalid syntax
4

2 回答 2

0

print是 python 3 中的一个函数,您使用的语法对应于 python2。

所以,你需要做

print("Goodbye, World!")
于 2014-08-01T20:07:29.277 回答
0
print("Goodbye, World!")

print是 Python 3 中的一个函数

于 2014-08-01T20:07:40.220 回答