关键区别 - python2 vs 3
Python is a High-level programming language. It is a multi-paradigm, which isObject-orientedas well asProcedure oriented。Python was found by Guido van Rossum. It is an easy programming language to learn and can be used in a variety of applications. There are two main versions of Python and they are Python 2 and 3. This article discusses the differences between these two versions. The关键区别在Python 2和3之间是Python 2将来将获得最低支持,而Python 3将来将继续发展更多。
CONTENTS
1。概述和关键差异
2。What is Python 2
3。What is Python 3
4。Python 2和3之间的相似性
5.并排比较 - python 2 vs 3以表格形式
6.Summary
什么是Python 2?
Python is one of the most popular languages for programming. Many companies use Python language for application development.谷歌,,,,YouTube,,,,Dropbox是其中一些。Python拥有一个庞大的社区,因为它易于学习,阅读和维护。它支持面向程序的编程以及面向对象的编程。
Python uses an口译员运行代码。与A不同compilerbased language, Python interpreter does not go through the whole code at once. Instead, it reads line by line and if the interpreter finds an error it stops preceding further and gives an error message to the user. Python 2 has been around longer, so it has more library availability. The most popular version of Python 2 is Python 2.7
What is Python 3?
Python 3被认为是Python的未来。它是developed to add more features and to fix bugs.It is continuously developing. Initially, Python 2 was popular but the idea of Python 3 is the future of the language, provided support to Python 3 as well.

图01:Python 3打印功能
Python 2和3的功能主要是相似的,这两个版本在语法和处理中存在差异。Python 3的主要优点是,新功能将不断添加到该语言中。
Python 2和3之间有什么相似之处?
- Both are versions of Python Language and general purpose.
- Both versions belong to High-level programming language category.
- Both are a multi paradigm thus, supports Object-oriented programming and Procedure-oriented programming.
- 两者都是基于口译的语言。
- Execution is slow comparing to compiler based languages.
- 两者都有一种易于编写,阅读和维护的语法。
- 两者都比其他语言易于调试程序。
- Both versions are a free and open source.
- Both are cross platformed, and available on a variety of platforms such as Linux, Mac, Windows.
- Python Shell为Python 2和3提供了交互模式。
- Both are capable to interface with various databases such asMYSQL,,,,Oracle,,,,MSSQL,,,,SQLite etc.
- 两者都使用自动垃圾收集器进行内存管理。
- 两者都能创建图形用户界面(GUI)。
- 这两个版本都不需要声明变量的类型。
- 两者都有包装的可用性。例如,用于科学计算的“ numpy”,“ scipy”,用于数据可视化的“ matplotlib”,“ django”,“烧瓶”,用于构建网站。
- Both can implement Multithreading.
Python 2和3之间有什么区别?
Python 2 vs Python 3 |
|
Python 2是Python编程语言的一种版本,将来将获得最低支持和其他功能。 | Python 3是Python编程语言的一种版本,它不断添加固定的新功能和错误。 |
Print Function | |
In Python 2, it is not compulsory to use parenthesis. e.g. print “Hello World” | In Python 3, it is compulsory to use parenthesis. e.g. print (“Hello World”) |
整数部门 | |
In Python 2, integer division returns an integer. 7/ 2 gives 3. To get the exact answer, the programmer should use 7.0 / 2. 0. | 在Python 3中,整数部门可以给出浮动答案。7/2将给出3.5。 |
Unicode支持 | |
要在Python 2中制作弦Unicode,应使用字符“ u”。例如你“你好” | In Python 3, string is Unicode by default. |
raw_input()函数 | |
在Python 2中,RAW_INPUT()函数用于从用户获取输入。此功能读取一个字符串。 | 在Python 3中,RAW_INPUT()函数不可用。 |
输入()函数 | |
在Python 2中,如果输入()函数可以用作字符串,如果它们在引号中,则可以用作数字。 | In Python 3, input() function reads the input as a string. |
next()函数 | |
在Python 2中,Generator Next()取下生成器的下一个值。 | 在Python 3中,它写为Next(Generator)。 |
第三方模块支持 | |
随着Python 2在那里持续更长的时间,具有更多的第三方模块支持。一些框架仍在使用Python 2。 | Python 3的第三方模块支持有限。 |
Summary – Python2 vs 3
Python语言有两个版本。Python 2和3之间的区别在于,Python 2将来将获得最低支持,而Python 3将来将继续进一步发展。两者都具有相似的功能,但其某些语法是不同的。无论哪种版本都用于构建应用程序。Python语言在数据分析,机器学习,自然语言处理,Web开发,科学计算,图像处理,机器人技术,计算机视觉等领域很有用。
下载python 2 vs 3的PDF版本
您可以下载本文的PDF版本,并根据引文注释将其用于离线目的。请在此处下载PDF版本差异 - 彼此之间的差异
参考:
1.二曲霉。“内容。”Python 2 vs Python 3:实际考虑|Digitalocean,Digitalocean,2017年11月29日。在这里可用
2。edurekaIN. YouTube, YouTube, 20 Feb. 2017.在这里可用
3.点,教程。“ Python 2 vs Python 3”,教程点,1969年12月31日。在这里可用
4.点,教程。“ Python 3中的新功能。”教程点,,,,15 Aug. 2017.在这里可用
图片提供:
1。’Python3-powered hello-world’ By Benjamin Hell (Public Domain) via下议院维基梅迪亚
Leave a Reply