Python programming tutorial: 01 Hello World!
Python by Guido Van Rossum was invented in the early 1990s, is one of the most popular programming languages, because of its clear and concise grammar I fell in love with Python, the code can basically be said to be executable pseudo-code.
Python contains a lot of content, plus a variety of standard library, expand the library, squandering for charming eyes. I have always wanted to write a quick, easy-to-use Python tutorial, and the language is simple, step by step, so that no background readers can also learn from the foundation.
Python command line
Assuming you have installed Python, then in the Linux command line input:
Will go directly to python. And then enter at the command line prompt >>> :
Can be seen, then output on the screen:
print is a commonly used function, its function is to output the brackets in the string.
(In Python 2.x, print can also be a keyword that can be written as print ‘Hello World!’ , But it does not work in 3.x )
Write a small program
Another way to use Python is to write a Python program. Use a text editor to write a .py at the end of the file. Example, hello.py
Write in hello.py as follows and save:
Exit the text editor, and then on the command line, enter:
to run hello.py. You can see Python then output
Python script
We can also change the Python program hello.py into an executable script that executes directly:
Need to modify the permissions of the above procedures for the executable:
Then on the command line, enter it
You can run directly.