简体   繁体   中英

How can I make the new python accept print without parentheses?

Is there a way I can change my settings in python such that I can use

print "hello world" instead of the new print ("hello world") without installing an earlier package of python

The only way is to use python2.x instead of python3.x. In python3.x, print is a function and there is no way to turn it back into a statement.

However, there are tools which can transform most python2 code to be compliant with python3. Check out 2to3 which generally ships with python3 distributions.

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