Python2.0 与 3.0 的区别

时间:2021-04-12 00:47:24

Python 2.0 =默认编码=ASSIC=不支持中文

Python 3.0 =默认编码=UNICODE=默认支持中文

 

In summary : Python 2.x is legacy, Python 3.x is the present and future of the language

总结:Python 2.x是遗产,Python 3.x 是现在和未来的语言。

Python 3.0 was released 发布  in 2008. The final  最终的  2.x version 2.7 release  发布  came out in mid-2010,

with a statement  声明  ofextended  延长 support  支持  for this end-of-life release.

The 2.x branch will see no new major releases after that. 3.x isunder 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).

Python 2 VS Python 3

1、默认支持中文

2、不兼容 2.0

3、核心语法调整易学

4、新特性默认只在3.x上有