Day1_Python基础_3.Python2 or 3 ?
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了Day1_Python基础_3.Python2 or 3 ?,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2636字,纯文字阅读大概需要4分钟。
内容图文
![Day1_Python基础_3.Python2 or 3 ?](/upload/InfoBanner/zyjiaocheng/1185/defc9d0e4dfb40458c56dbbc5a3de78d.jpg)
三、Python 2 or 3?
In summary : Python 2.x is legacy, Python 3.x is the present and future of the language
Python 3.0 was released in 2008. The final 2.x version 2.7 release came out in mid-2010, with a statement of
extended support for this end-of-life release. The 2.x branch will see no new major releases after that. 3.x is
under active development and has already seen over five years of stable releases, including version 3.3 in 2012,
3.4 in 2014, and 3.5 in 2015. This means that all recent standard library improvements, for example, are only
available by default in Python 3.x.
Guido van Rossum (the original creator of the Python language) decided to clean up Python 2.x properly, with less regard for backwards compatibility than is the case for new releases in the 2.x range. The most drastic improvement is the better Unicode support (with all text strings being Unicode by default) as well as saner bytes/Unicode separation.
Besides, several aspects of the core language (such as print and exec being statements, integers using floor division) have been adjusted to be easier for newcomers to learn and to be more consistent with the rest of the language, and old cruft has been removed (for example, all classes are now new-style, "range()" returns a memory efficient iterable, not a list as in 2.x).
py2与3的详细区别
PRINT IS A FUNCTION
The statement has been replaced with a print() function, with keyword arguments to replace most of the special syntax of the old statement (PEP 3105). Examples:
You can also customize the separator between items, e.g.:
1
|
print
(
"There are <"
,
2
*
*
32
,
"> possibilities!"
, sep
=
"")
|
ALL IS UNICODE NOW
从此不再为讨厌的字符编码而烦恼
还可以这样玩: (A,*REST,B)=RANGE(5)
1
2
3
4
|
<strong>>>> a,
*
rest,b
= range ( 5 ) >>> a,rest,b
(
0
, [
1
,
2
,
3
],
4
)
<
/
strong>
|
某些库改名了
Old Name |
New Name |
_winreg |
winreg |
ConfigParser |
configparser |
copy_reg |
copyreg |
Queue |
queue |
SocketServer |
socketserver |
markupbase |
_markupbase |
repr |
reprlib |
test.test_support |
test.support |
还有谁不支持PYTHON3?
One popular module that don‘t yet support Python 3 is Twisted (for networking and other applications). Most
actively maintained libraries have people working on 3.x support. For some libraries, it‘s more of a priority than
others: Twisted, for example, is mostly focused on production servers, where supporting older versions of
Python is important, let alone supporting a new version that includes major changes to the language. (Twisted is
a prime example of a major package where porting to 3.x is far from trivial
原文:http://www.cnblogs.com/wangcx/p/6688777.html
内容总结
以上是互联网集市为您收集整理的Day1_Python基础_3.Python2 or 3 ?全部内容,希望文章能够帮你解决Day1_Python基础_3.Python2 or 3 ?所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。