零基础学python是学2还是3好

Python与SEO 思享 1884浏览

对于python的初学者来说,会发现其实很多人都是用得python2.7,但是目前python已经更新到了3点几的版本。是学习最新的3好呢,还是应用比较广的2.7好呢?看看大家怎么说

python

官方说法

In November 2014, it was announced that Python 2.7 would be supported until 2020, and reaffirmed that there would be no 2.8 release as users were expected to move to Python 3.4+ as soon as possible

百度翻译:今年2014年11月宣布,Python 2.7将在2020之前得到支持,并重申不会有2.8版本的发布,因为用户希望尽快移动到Python 3.4以上。

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).

百度翻译:

总之:Python 2是遗留的,Python 3是语言的现在和未来。

Python 3在2008发布。最后的2×2.7版本发布了2010年年中,与声明

延长对这一报废版本的支持。在这之后,2 x分支不会看到新的主要版本。3 x是

在积极的发展中,已经看到了五年的稳定版本,包括2012版3.3版,

3.4在2014,2015在3.5。这意味着,所有最近的标准库的改进,例如,只

默认使用Python 3。

Guido van Rossum(Python语言的创造者)决定清理Python 2。x是正确的,不考虑向后兼容性比在2新版本的情况下,X系列。最激烈的改进是更好的支持Unicode(所有文本字符串是Unicode默认)以及理智的字节/ Unicode分离。

此外,在语言的核心的几个方面(如打印和exec被陈述,整数使用地板处)已被调整到适合新人学习容易,要与其他的语言更加一致,老的那些东西已被删除(例如,所有的类都是现在新型的、“range()”返回一个高效的迭代,不列为2 x)。

培训教师的建议

  1. 如果是你在企业中,需要用到python而学习python的话,那就要看企业的应用python的版本进行学习;
  2. 如果想要更多的成熟解决方案,最少的bug,最稳定的应用那就用python2 ;
  3. 如果你是在读大学的学生,那我建议你学习python3,等到毕业的时候或许python已经成为了主流。

使用者观点

观点一

python 3 有很大改进,比 2 更容易理解。

如果题主决定学 2,建议当被 string bytes 搞晕时,了解一下 3,再做决定。

另外,3 的库已经比较全了,不支持 3 的,多数是不再维护的。

观点二

从开源项目可以看出,新项目基于或支持Python3 的比例已经大大提高。
知名的开源项目一般都是支持python2.7 和 python3+, 也有例外,比如Scrapy 只支持Python2.7。

如果是新项目,并且对已有项目没有依赖,建议选择Python3.3+。
否则选择Python2.7 (2.7 以前的基本被废弃了)

观点三

没有历史包袱就果断用3。 之前写了一大堆2的代码了没办法那只能用2了。 现在大多数常用库都支持3了。

推荐阅读

Python实现聚合问答采集文章

最近在一个社区得到了一个用python聚合问答的工具,但是因为已经打包成程序了,所以无法研究,于是在网上找了一个网友分享的源代码,转载于此,供志愿者学习和后期扩展。这个工具可以通过头条搜索、百度下拉结果、搜狗下拉、百度知道搜索、新浪爱问、搜狗问问,将......

pycharm文件大小超过配置限制(2.56M),代码洞察功能不可用

Pycharm软件有默认的文件大小限制,一般为2.56MB,如果打开大于2.56MB的文件,会提示“文件大小超过配置限制,code insight功能不可用。”这时候我们可以通过修改相关配置来解决这个问题。单击帮助>>编辑自定义属性...在菜单栏上,......

pycharm怎么用国内镜像安装第三方库

1、在pycharm中打开Terminal,如下图。 2、以安装pymysql库为例,输入以下命令回车即可使用镜像安装。 pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pymysql ......