First, the first sentence of Python code
（LinuxThe system creates a hello.py file in the /home/dev/ directory, which reads as follows:
Execute the hello.py file, namely:
Suffix name can be arbitrary, but when the program is more complex, the file import module, the suffix name is not py, easy to make mistakes.
Later, the name of the file suffix is PY
pythonThe internal execution process is as follows:
Two, interpreter (Python code two ways of execution)
a）First, when we executed Python /home/dev/hello.py hello.py in the previous step, we explicitly pointed out that the hello.py script was executed by the Python interpreter.
If you want to execute Python scripts as well as executing shell scripts, case:
./hello.py ，So it needs to beThe header specified interpreter in the hello.py file，As follows:
In this way, execute.
/hello.py You can.
ps：Hello.py is required before execution, Chmod 755 hello.py
b）Second, enter the Python interpreter, input the code directly, output the result.
- windowsSystem, command prompt, enter python, enter the Python interpreter.
Multi line annotation: “” “annotated content” “”
Four. Execution of operation
Wait forever, until the user enters the value
input（“Please enter the username.
Assign the input value to the n
n = input（“Please enter the username.
Five. Basic data types
Content in quotation marks
Addition, subtraction, multiplication, and division
Sub Party: * * *
%：Get the remainder
temp = a % 2
if temp = 0
print(“Even number “)
print(“Odd number “)
//：The integer part of a quotient