您的位置:首页 > 编程语言 > Python开发

python print 错误 ( invalid syntax)

2013-10-04 16:19 302 查看
刚刚在windows 上安装了python ,想print 字符串,但是一直报错 (python 3.3 .2版本)

>>> print hello

SyntaxError: invalid syntax

>>> print 'hello'

SyntaxError: invalid syntax

>>> print "hello"

SyntaxError: invalid syntax

>>> print "hello";

SyntaxError: invalid syntax

>>> print (hello)

Traceback (most recent call last):

File "<pyshell#4>", line 1, in <module>

print (hello)

NameError: name 'hello' is not defined

>>> print ('hello')

hello

# 最后这个有效,好像和2.7版本的差别挺大的,不知道和不同平台有没有关系,之前一直在ubuntu上使用python

# 在ubuntu上,上面几种写法好像都支持
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: