Variables: a container for storing data,
Identifier naming rules:
1. Alphanumeric underscore
2. Do not start with a number
3. case sensitive
4. reserved word can not be named
5. descriptive word should be used to name variables, not Chinese and Pinyin
6. Camel, separated by underscores (recommended)
Operator:
Arithmetic operators: + - * / // **%
Assignment operators: + = = - = = * / ** =% = = = //
Comparison operators:> <> = <= = ==!
Logical operators: and or not
priority:()
Operator Identity: is (if type (XX) is int: print ( 'right'))
is not
Member operator: in not in
Comment:
Single-line comments: #
Multi-line comments: '' '-' '' '' '--- "" "
if statement:
while loop: break off cycle ends when cycles continue
for语句 for var in sequence
Production flow chart website: Processon
type of data:
Numeric types: int, float, complex
String: "xxx", 'xxx', "" "xxx" "" repr ( 'xx \ n xx') can be printed out \ n and quotes
Slice format string str [start: end: step]
Formatted output format ()
+、*
Boolean value:
TRUE、
FLASE: None, Flase, any type represents a number of 0 0,0.0,0j
Any empty sequence (lists, tuples, dictionaries), any empty map
List:
['','']
Tuple
() The same list
dictionary:
{ 'Key': 'value', 'key': 'value'} disorder, a unique key
File operations:
1.open, and get a handle
2. Operation: read and write rwa r + w + a +
3.close
seek (self, cookie (positional deviation), whence = 0 (where the offset from the beginning, from the file head position represents 0, 1 from the current position, from the end of the file represents 2)) to move the pointer to the specified position
tell (self, /) file pointer position
with statements without having to manually close.