简体   繁体   中英

Python3 print statement doesn't work as expected

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'.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM