首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

Python的版本

There is now one main version of Python,that is Python 3. However, until the start of 2020 there were two mainsupported versions in circulation one called Python 2 as well as Python 3.

l Python 2 was launched in October 2000 and was widely used. Supportfor this version of Python ended on the 1st of January 2020.However, you will still find examples of code, libraries and tutorials thatfocus on this version of the language,. This is particularly true of the web sobe careful when browser for examples or help-make sure they relate to Python 3.The more current the article or suggestion you are looking the more likely thatit is Python 3.

l Python 3 was launched in December 2008 and is a major revision tothe language that is not backward compatible. It is current the most widelyused bersion of the language and represents the version we will use throughoutthis book.

l In Python 2 this is written as “print ‘Hello World’”

l In Python 3 this is written as “print(‘Hello World’)”

现在,Python 只有一个主要版本,即 Python 3。不过,直到 2020 年初,仍有两个主要的支持版本在流通,一个叫 Python 2,另一个叫 Python 3。

l Python 2 于 2000 年 10月推出,并被广泛使用。对该版本 Python 的支持已于2020 年 1 月 1 日终止。不过,您仍然可以找到该版本语言的代码示例、库和教程。网络上的情况尤其如此,因此在浏览示例或帮助时要小心--确保它们与 Python 3 有关。您查找的文章或建议越新,就越有可能是 Python 3。

l Python 3 于 2008 年 12月发布,是对语言的一次重大修订,它不向后兼容。它是目前使用最广泛的语言版本,也是我们将在本书中使用的版本。

l 在 Python 2 中,这句话被写成 "print 'HelloWorld'"。

l 在 Python 3 中,这句话被写成 "print('HelloWorld')"

It may not look like much of a differencebut the inclusion of the ‘()’ marks a major change and means that any codewritten for one version of Python will probably not run on the other version.There are tools available, such as the 2-3 utility, that will (partially)automate translation from Python 2 to Python 3 bbut in general you are stillleft with significant work to do.

看起来差别不大,但"() "的加入标志着一个重大变化,意味着为一个 Python 版本编写的代码可能无法在另一个版本上运行。有一些工具(如 2-3 工具)可以(部分地)自动完成从 Python 2 到 Python 3 的转换,但总的来说,您仍有大量的工作要做。

A survey of Python Developers carried outby JetBrains(the organization behind to PyCharm editor) in 2022 found that only2% of developers now claimed to be using a Python 2.x version, with 2% unsurewhich version they used. The rest(96%) were using a version of the 3.x linemostly 3.8, 3.9 or 3.10. This survey was completed before 3.11 was madeavailable, and this over 70% of developers were using one of the three mostrecent versions of Python. For more information see https://www.jetbrains.com/lp/devecosystem-2022/python/.

2022 年,JetBrains(PyCharm 编辑器的幕后组织)对 Python 开发人员进行了一项调查,发现目前只有 2% 的开发人员声称自己使用的是 Python 2.x 版本,2% 的人不确定自己使用的是哪个版本。其余的开发者(96%)使用的是 3.x 版本,主要是 3.8、3.9 或 3.10。这项调查是在 3.11 发布之前完成的,超过 70% 的开发者使用的是 Python 三个最新版本中的一个。更多信息请参见https://www.jetbrains.com/lp/devecosystem-2022/python/。

Python 3 is the future(未来) of the Python language, and it is this version that has introducedmany of the new and improved language and library features(that have admittedlybeen back ported to Python 2 in many cases). This book is solely focused onPython 3.

Python 3 是 Python 语言的未来,正是这个版本引入了许多新的、改进的语言和库特性(在许多情况下,这些特性被移植到了 Python 2)。本书只关注 Python 3。

In the remainder of this book when we referto Python we will always be referring to Python 3. Since then there have beennumerous point and sub point releases, for example, as well as Python 3.1, 3.2,etc. there have also been intermediate releases such as 3.1.1, 3.1.2, etc.

在本书的其余部分,当我们提到 Python 时,我们总是指 Python 3。从那时起,Python 已经发布了无数个点和子点版本,例如,除了 Python 3.1、3.2 等之外,还有 3.1.1、3.1.2 等中间版本。

  • 发表于:
  • 原文链接https://page.om.qq.com/page/OQJt4PRAhJ5lWOf2A4Z023kg0
  • 腾讯「腾讯云开发者社区」是腾讯内容开放平台帐号(企鹅号)传播渠道之一,根据《腾讯内容开放平台服务协议》转载发布内容。
  • 如有侵权,请联系 cloudcommunity@tencent.com 删除。

扫码

添加站长 进交流群

领取专属 10元无门槛券

私享最新 技术干货

扫码加入开发者社群
领券