python print 错误 ( invalid syntax)

来源:互联网 发布:go编程语言 编辑:程序博客网 时间:2024/05/01 10:09

刚刚在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上,上面几种写法好像都支持

原创粉丝点击