该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
楼上这个“学”字用的有问题吧?
2和3基本上差不多,学了一个,只要留意一下区别,马上就会了另一个。
所以真正的问题不是“学哪个”,而是“用哪个”,因为这牵扯到第三方模块的生态圈问题。
Python官方的意见是:
In particular, instructors introducing Python to new programmers may want to consider teaching Python 3 first and then introducing the differences in Python 2 afterwards (if necessary), since Python 3 eliminates many quirks that can unnecessarily trip up beginning programmers trying to learn Python 2.
特别是,教师在给新手教Python的时候,可以先教3,然后再讲讲2和3的区别(如果需要的话)。因为3改进了2的很多“怪癖”,这些“怪癖”可能对新手造成不必要的迷惑。
However, there are some key issues that may require you to use Python 2 rather than Python 3.
Firstly, if you're deploying to an environment you don't control, that may impose a specific version, rather than allowing you a free selection from the available versions.
Secondly, if you want to use a specific third party package or utility that doesn't yet have a released version that is compatible with Python 3, and porting that package is a non-trivial task, you may choose to use Python 2 in order to retain access to that package.
另外,也许有两条重要的因素要求你使用Python2,而不是3:
1、在某些你控制不了的环境,逼迫你使用指定版本。(译注:比如接手一个Python2写的既有项目)
2、如果你要使用某些第三方包/模块,而这些第三方包/模块没有迁移到Python3,并且迁移的工作量很大,你可以选择Python2。
所以,楼主先学着,学的过程中留意一下你可能用到的第三方包/模块是否已经迁移到3。