1. View Python version
Python-v
2. Specify the encoding format for Python files
#-*-Coding:utf-8-*-
3. The variable name begins with a letter and an underscore (_)
_num num
4. Comment # begins with a comment on the line
# Here is the comment section
5, multi-line statement with backslash (\) Implementation
Toatl = Num1 + \
Num2 + \
Num3
6. Data type: Number (integer, Boolean, floating-point, plural), string (string), List (list []), tuple (tuple ()), sets (set {}), Dictionary (dictionary)
Number: Integer (1), floating-point number (1.23), complex number (1+2J)
String: element cannot be changed, can be sliced
List: Elements can be changed, can be sliced
Tuple: element cannot be changed, can be sliced, a tuple containing an element should be followed by a comma, such as Tup = (1,)
Set: unordered non-repeating element sequence, creating an empty collection must set () instead of {}
Dictionary: Unordered key (key): value pairs the set, key (key) is immutable type, create empty dictionary with {}
7. String
Single and double quotation marks for single-line strings (using the same)
Specify multiple lines of string between three quotation marks ("' or" ")
Natural string, preceded by the string R or r,r "Hello World \ n", will not be escaped and displayed as Hello World \ n
8, the same line shows more than one statement, separated by a semicolon (;) between statements
x = 3; y = 4
9. Data type conversion
Returns a new object as a function name, simple as int (x), float (x), str (x), etc.
Python3 Basics of Getting Started