Hackerthink logo

THE MOST POPULAR SITE FOR DEVELOPERS.

Python Tutorial

Python is an interpreted, object-oriented, high-level programming language with dynamic data types.

Python was invented by Guido van Rossum at the end of 1989, and the first public release was released in 1991.

Like the Perl language, the Python source code also follows the GPL (GNU General Public License) agreement.

It is officially announced that on January 1, 2020, the update of Python 2 will be stopped.

Python 2.7 was determined to be the last Python 2.x version.

Who should read this tutorial?

This tutorial is suitable for developers who want to learn the Python programming language from scratch. Of course, this tutorial will also go into some modules to give you a better understanding of the application of Python.

This tutorial is mainly for learning the Python 2.x version. If you are using the Python 3.x version, please move to the Python 3.x version of the tutorial .

All examples in this tutorial are based on Python2.7.

Before following this tutorial you need to know

Before continuing this tutorial, you should understand some basic computer programming terms. If you have studied PHP, ASP and other programming languages, it will help you understand Python programming faster.

Execute Python program

For most programming languages, the first introductory programming code is “Hello World!”, the following code uses Python to output “Hello World!”:

Example

#!/usr/bin/python
 
print("Hello, World!")

Python 3.0+ version already uses print as a built-in function, and the output “Hello World!” code is as follows:

Example

#!/usr/bin/python3
 
print("Hello, World!")