Home Backend Development Python Tutorial Which one is more commonly used, python2 or 3?

Which one is more commonly used, python2 or 3?

Jun 12, 2019 am 10:42 AM

The language was born in the 1990s. It is already a 25-year-old uncle-level language by now (there is also a famous java in the same era, which was released in 1995 and became popular a few times. Ten years). But Python’s real fame came many years later than Java. In fact, it was mainly due to the changes in the application field. (guess why, yes, the emergence of big data)

Which one is more commonly used, python2 or 3?

Python2

is a very important version of Python. The earliest version started in 2001, especially the release of py2.5 starting in 2006. The functions of python It gradually became stronger and stabilized, and one version was added every 1-2 years. It slowly became popular around 2008. Python3 was first released in 2008, but the version of py3.0 was very different. It is stable, so the community updates quickly, every few months. So not many people used it at the beginning. It was only when python3.4 was delivered in the spring of 2014 that it began to slowly stabilize. Let’s look at a piece of data below. This is a piece of data compiled by the Python community and some websites in 2014. The survey, regarding Python2/3, some results are as follows:

1).97.51% of users are still writing Python2 code

2).60% of users are writing Python3 code

3).78.09% of users write more Python2 code

4).77.09% of users recognize Python3. Currently, some operating systems in Linux already use Python3 by default:

1).Arch Linux (lightweight Linux operating system)

2).Ubuntu 16.04 (a desktop application-based Linux operating system)

3).Fedora (Redhat desktop version Continuation)

Related recommendations: "python video tutorial"

2. The main difference between Python2 and Python3:

The latest data is that Python has two versions: one is version 2.7.12 and the other is version 3.5.12. So Python2 runs well, why is Python3 suddenly released? In fact, it is to solve some of the history in Python2 The first problem is about strings:

1. Chinese text and binary data are a mess. It is ambiguous whether str in Python represents binary data or text data. Text can represent both text data. It is troublesome to represent binary data, and it is difficult for us to realize when such errors occur. The second is support for Unicode. Since Python was released as open source in February 1991, this means that it preceded the first version of the Unicode standard, which was released in October 1991. In the next few years, languages ​​that emerged later than the Unicode standard chose to implement their own str type on the basis of supporting Unicode encoding, which put Python 2 in an awkward position. Currently, we are in an era where python2/3 coexist, and these two versions are incompatible.

2. python2 is currently only doing bug fixes and maintenance related to new hardware and operating system compatibility. No new features will be added, and python2 will only be supported until 2020. Now Python is evolving towards version 3. During the evolution process, a large amount of code for the 2.x version needs to be modified before it can run, so there are currently many Third-party libraries are temporarily unavailable on 3.x. But you can think about it, maybe the situation will be much better in a few years. After all, there are many excellent programmers around the world migrating some libraries from Py2 to Py3.

3. The choice still depends on your own If the requirement is enterprise development, it must meet the work needs, especially if the dependent software can only run under Python2, Python2 is the first choice. For example, your development needs to rely on a large number of third-party libraries (because one of the reasons why learning Python is very important is It has thousands of third-party packages), such as a large number of data analysis and scientific calculations, so choose Python2. If you study and research by yourself and are willing to embrace changes, then it is recommended to learn Python3, because it is the direction of the future. .Conclusion: Programming is actually mainly about the understanding of programming ideas and the accumulation of experience. Don’t waste a lot of time just because you are confused about whether to learn Py2 or Py3.

4. The ideas in Py2 and Py3 are basically the same, and the moves are similar. When you are familiar with Python to a certain program, it only takes a short time for someone who knows Py2 to learn Py3. So don’t waste precious learning time by worrying about minute grammatical differences. Okay, that’s it for the grievances between Python2 and Python3 (they will still love and kill each other for a while). I hope it can give some inspiration to beginners. If you don’t understand anything, you can also leave a message with me to discuss and communicate.

The above is the detailed content of Which one is more commonly used, python2 or 3?. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to solve the permissions problem encountered when viewing Python version in Linux terminal? How to solve the permissions problem encountered when viewing Python version in Linux terminal? Apr 01, 2025 pm 05:09 PM

Solution to permission issues when viewing Python version in Linux terminal When you try to view Python version in Linux terminal, enter python...

How to avoid being detected by the browser when using Fiddler Everywhere for man-in-the-middle reading? How to avoid being detected by the browser when using Fiddler Everywhere for man-in-the-middle reading? Apr 02, 2025 am 07:15 AM

How to avoid being detected when using FiddlerEverywhere for man-in-the-middle readings When you use FiddlerEverywhere...

How to efficiently copy the entire column of one DataFrame into another DataFrame with different structures in Python? How to efficiently copy the entire column of one DataFrame into another DataFrame with different structures in Python? Apr 01, 2025 pm 11:15 PM

When using Python's pandas library, how to copy whole columns between two DataFrames with different structures is a common problem. Suppose we have two Dats...

How does Uvicorn continuously listen for HTTP requests without serving_forever()? How does Uvicorn continuously listen for HTTP requests without serving_forever()? Apr 01, 2025 pm 10:51 PM

How does Uvicorn continuously listen for HTTP requests? Uvicorn is a lightweight web server based on ASGI. One of its core functions is to listen for HTTP requests and proceed...

How to solve permission issues when using python --version command in Linux terminal? How to solve permission issues when using python --version command in Linux terminal? Apr 02, 2025 am 06:36 AM

Using python in Linux terminal...

How to teach computer novice programming basics in project and problem-driven methods within 10 hours? How to teach computer novice programming basics in project and problem-driven methods within 10 hours? Apr 02, 2025 am 07:18 AM

How to teach computer novice programming basics within 10 hours? If you only have 10 hours to teach computer novice some programming knowledge, what would you choose to teach...

How to get news data bypassing Investing.com's anti-crawler mechanism? How to get news data bypassing Investing.com's anti-crawler mechanism? Apr 02, 2025 am 07:03 AM

Understanding the anti-crawling strategy of Investing.com Many people often try to crawl news data from Investing.com (https://cn.investing.com/news/latest-news)...

See all articles