开发者

Python3 print statement doesn't work as expected

I am using Python 3.2.2

>>开发者_StackOverflow社区;> s = 'hhh'
>>> print s
SyntaxError: invalid syntax
>>> print(s)
hhh
>>> print 2*2
SyntaxError: invalid syntax
>>> print(2*2)
4

Why do I have to use print("...") to print something? If I dno't it complains with 'SyntaxError'.


As of python 3.0, print is a function. See:

http://docs.python.org/release/3.0.1/whatsnew/3.0.html#print-is-a-function

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜