Python 3 Tutorial
Python's 3.0 version, often called Python 3000 or simply Py3k. Compared to the earlier versions of Python, this is a significant upgrade. To avoid bringing in too much baggage, the design of Python 3.0 did not consider backward compatibility.
Python Introduction and Installation Tutorial we have already covered inPython 2.X version tutorialWe have already covered this in the previous section, so no further explanation is needed here.
You can also clickPython2.x and 3.x version differencesTo see the differences between them.
This tutorial is mainly aimed at learning Python 3.x version. If you are using Python 2.x version, please refer toPython 2.X version tutorial。
The official announced that Python 2 will no longer receive updates starting January 1, 2020.
Check Python version
We can use the following command in the command window (Windows use win+R to open the cmd run box) to check the version of Python we are using:
python -V 或 python --version
The result of the above command execution is as follows:
Python 3.3.2
You can also enter the interactive programming mode of Python to check the version:
Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:03:43) [MSC v.1600 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>>
First Python3.x Program
For most programming languages, the first entry-level programming code is"Hello World!", the following code outputs"Hello World!":
Common file extensions for Python.py。
You can save the above code inhello.pyfile and execute the script file using the python command.
$ python3 hello.py
The output result of the above command is:
Hello, World!Other extensions