+
95
-

python2与python3有什么区别?

python2与python3有什么区别?

网友回复

+
15
-

Python 2于2000年10月16日发布,稳定版本是Python 2.7。Python 3于2008年12月3日发布,不完全兼容Python 2。

python2 的代码混乱,重复较多,冗余。

python3源码规范、清晰、简单优美。

两者废弃类差异:

1. print 语句被 Python3 废弃,统一使用 print 函数 ; 2. exec 语句被 python3 废弃,统一使用 exec 函数 ; 3. execfile 语句被 Python3 废弃,推荐使用 exec(open("./filename").read()) ; 4. 不相等操作符"<>"被 Python3 废弃,统一使用"!=" ; 5. long 整数类型被 Python3 废弃,统一使用 int ; 6. xr...

点击查看剩余70%

我知道答案,我要回答