click on blue
picture
Follow us

From the Internet, intrusion and deletion


Python interactive programming
picture

We can start the Python interpreter by entering the "Python" command in the command prompt:

$ python3

After executing the above command, the following window information appears:

$ python3
Python 3.4.0 (default, Apr 11 2014, 13:05:11)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

Enter the following statement at the python prompt and press Enter to see the effect:

print ("Hello, Python!");

The result of executing the above command is as follows:

Hello, Python!

Continuation lines are required when typing a multiline structure. We can look at the following if statement:

>>> flag = True
>>> if flag :
...     print("flag 条件为 True!")
...
flag 条件为 True!




Python scripting programming
picture

Copy the following code to the hello.py file:

print ("Hello, Python!");

Execute the script with the following command:

python3 hello.py

The output is:

Hello, Python!

On Linux/Unix systems, you can make Python scripts directly executable like SHELL scripts by adding the following command at the top of the script:

#! /usr/bin/env python3

Then modify the script permissions to have execute permissions, the command is as follows:

$ chmod +x hello.py

Execute the following command:

./hello.py

The output is:

Hello, Python!

picture


Long press or scan the QR code below to get  free Python open courses and hundreds of gigabytes of learning materials packaged by the big guys , including but not limited to Python e-books, tutorials, project orders, source code, cracked software, etc.

picture

Scan the QR code - get it for free



Wonderful review of the past




Notes on Python file reading
and writing The best combination of writing Python code on Windows!
Notes on Python file reading and writing
Dependency management of Python packages, solved!



Click  to read the original text to learn more