Which version should a novice learn python download?

People who want to learn Python will have a puzzle, that is, there are currently two versions of Python, Python2 and Python3. What is the difference between Python2 and Python3, and which version should I learn?

Python3 and python2 are incompatible, and the differences are relatively large. Python3 is not backward compatible, but most of the components and extensions are based on python2. At present, most of the actual applications do not consider Python3, and sometimes pay attention to writing 2/3 compatible code. When writing new code based on Python2, consider the possibility of migrating to Python3 in the future. According to statistics, 10% currently use Python 3; 20% use both Python 2 and Python 3, and Python 2 uses more; 70% use Python 2.

In fact, python is one of the most commonly used software on linux, but most of the current versions of linux still use python2, and there are more programs that rely on python2 on linux, so it will take several years for Python3 to replace python2 and become the mainstream. . If you still learn Python 2 in order to find a job and learn Python 2, it is not difficult to switch from Python 2 to python3.

After talking for a long time, what is the difference between Python2 and Python3?

1. performance

Py3.0 runs pystone benchmark speed 30% slower than Py2.5. Guido believes that Py3.0 has a lot of room for optimization, and it can achieve good optimization results in string and plastic operations.

Py3.1 performance is 15% slower than Py2.5, there is still a lot of room for improvement.

2. coding

Py3.X source code files use utf-8 encoding by default, which makes the following code legal:

 China='china'print(China)
 china

3. grammar

1 ) Removed <, use != instead,

2 ) Remove "and use repr() for all,

3 ) The keywords are added as and with, as well as True, False, None,

4 ) Integer division returns a floating point number. To get an integer result, use //,

5 ) Add nonlocal statements. Use noclocal x to directly assign peripheral (non-global) variables,

6 ) Remove the print statement and add the print() function to achieve the same function. There is also the exec statement, which has been changed to the exec() function.

Python version and software download:

Python V3.7. for x64 (Python programming development tool) official installation version

Python 3.7 for win32 (Python programming development tool) official installation version

At this point, this article on which version of python should be downloaded by novices is introduced here. For more related learning python which version to download, please search for the previous article of ZaLou.Cn or continue to browse the related articles below. Hope you will support ZaLou more in the future. .Cn!

Recommended Posts

Which version should a novice learn python download?
How long can a zero-based novice learn python
Which version of python does windows support
Python or JavaScript which is easy to learn
Which is easy to learn python or php
Which python2 or python3 has a high usage rate