I am using Python 3.2.2
>>> 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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.