1. Exit Python with exit ()
2. The statement beginning with # is a comment
3, the PY uses the indentation format
Code indentation refers to the hierarchical relationship between each line of code by typing a space or tab in front of each line of code. Any programming language requires the structure of the Code indentation specification, and the programming style that uses the code indentation facilitates the reading and comprehension of the code. For C, C + +, Java and other languages, code indentation is just a good habit of programming and deferred. For Python, code indentation is a syntax that does not use curly braces or begin...end in the Python language ... Separating blocks of code, instead using colons and code indentation to differentiate between code levels.
If the program does not take the style of code indentation, it throws a Indentationerror exception
It is best to indent with 4 spaces when indenting (this is not mandatory, it is the contract idiomatic)
4, Case sensitive
5, add a space on each side of the assignment operator, is a good writing habit
6. Python identifiers
A python identifier is a name used to identify a variable, function, class, module, or other object. Identifiers are followed by letters A through Z or a?z with 0 or more letter underscores (_), underscores, and numbers (0?9).
Python does not allow punctuation character identifiers, such as @,$ and%
7. Reserved words
The following list shows the reserved words in Python. These reserved words cannot be used as constants or variables or any other identifier names.
| and |
Exec |
Not |
Assert |
Finally |
| Or |
Break |
For |
Pass |
Class |
| From |
Print |
Continue |
Global |
Raise |
| Def |
Import |
Try |
Elif |
Inch |
| While |
Else |
Is |
With |
Except |
| Lambda |
Yield |
If |
Return |
Del |
8, multi-line statements
Usually a line is put in one statement, but a continuation character (\) is allowed. The line continuation character cannot be used in the statement [], {}, or (), as follows:
Total = a1 + + a3
9, semicolon (;) allows multiple statements to be written on a single line
Python Learning Note (i): basics