简体   繁体   English

如何使新的python接受不带括号的打印?

[英]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 有没有一种方法可以更改python中的设置,以便可以使用

print "hello world" instead of the new print ("hello world") without installing an earlier package of python print "hello world"而不是新print ("hello world")而无需安装早期的python软件包

The only way is to use python2.x instead of python3.x. 唯一的方法是使用python2.x而不是python3.x。 In python3.x, print is a function and there is no way to turn it back into a statement. 在python3.x中, print是一个函数,无法将其转换为语句。

However, there are tools which can transform most python2 code to be compliant with python3. 但是,有些工具可以 大多数 python2代码转换为与python3兼容。 Check out 2to3 which generally ships with python3 distributions. 查看2to3 ,它通常随python3发行版一起提供。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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