Pythonc on the difference between---2x version and 3x version

Source: Internet
Author: User

The 3.0 version of Python, often referred to as Python 3000, or simply py3k. This is a large upgrade relative to earlier versions of Python.

In order not to take in too much of a burden, Python 3.0 did not consider downward compatibility when designing.

Many of the programs designed for early Python versions are not performing properly on Python 3.0.

To take care of the existing program, Python 2.6, as a transitional version, basically uses the syntax and library of Python 2.x, taking into account the migration to Python 3.0, allowing the use of some of the syntax and functions of Python 3.0.

The new Python program recommends using the Python version 3.0 syntax.

Unless the execution environment cannot install Python 3.0 or the program itself uses a third-party library that does not support Python 3.0. Currently does not support Python 3.0 third-party library has twisted, py2exe, PiL and so on.

Most third-party libraries are striving to be compatible with Python version 3.0. Even if Python 3.0 is not immediately available, it is recommended that you write a program that is compatible with Python version 3.0 and then execute it using Python 2.6, Python 2.7来.


About the difference between the print function:

The print statement is gone and replaced by the print () function. Python 2.6 and Python 2.7 support this form of print syntax in parts.


About the differences between Unicode

Python 2 has an ASCII str () type, Unicode () is separate, not a byte type.

Now, in Python 3, we end up with a Unicode (Utf-8) string, and a byte class: Byte and Bytearrays.

Because python3.x source files use utf-8 encoding by default


This article is from the "12380959" blog, please be sure to keep this source http://12390959.blog.51cto.com/12380959/1881231

Pythonc on the difference between---2x version and 3x version

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.