Home  >  Article  >  Backend Development  >  Which one should I learn, python2 or python3?

Which one should I learn, python2 or python3?

(*-*)浩
(*-*)浩Original
2019-06-12 14:49:523686browse

Many friends who are just getting started with Python are struggling with the question: Should I choose to learn python2 or python3?

Which one should I learn, python2 or python3?

##To this, the answer is: Decisive Python3!(Recommended learning: Python video tutorial)

However, there are still many novice friends who are still hesitant: Then why do some people still recommend me to learn Python2?

In fact, there are no more than the following reasons:

1. Whether it is Python or Pip, the number of downloads is 2 to 3. It can be seen that 2 is still the mainstream

wrong! There are many reasons why 2 has more downloads than 3, but one of the most important ones is that the vast majority of operating systems (Linux distributions) still install Python 2 by default. People are lazy, and many people just use 2 if they are too lazy to bother. However, it is an indisputable fact that 2 is declining and 3 is rising. Embracing the future is the way to go.

2. Python 2 and 3 are not compatible. After learning 3, you still have to learn 2

Wrong! Python provides many auxiliary libraries that allow you to write code compatible with 3 and 2 in minutes. All you have to do is introduce a few packages, and there is almost no need to modify the code. You really have to use 2 as a last resort. If you have a foundation in 3, you can get started with 2 immediately without any additional learning.

3. Many libraries are still stuck in Python 2 and cannot be used in Python 3

Wrong! The dear friend who said this, how long has it been since you paid attention to Python? I don't understand the market very well.

According to the latest statistical results of py3readiness, 345 of the top 360 most popular (most downloaded) libraries on Pip already support Python 3

Which one should I learn, python2 or python3?

Among them, only 15 (about 4%) libraries remain that do not support Python 3 yet. How persistent are you that you have to wait until 100% before using 3?

How special can your job be? Do you have to use 2 to get it? Even if you encounter such a situation, use mature tools such as virtualenv and conda to create a new 2 environment on your machine in minutes, which is perfectly compatible with 3. What else do you need to worry about?

Embrace Python 3! Life is short, I use Python 3.

For more Python-related technical articles, please visit the

Python Tutorial column to learn!

The above is the detailed content of Which one should I learn, python2 or python3?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn