1. String formatted output
- % Placeholders:% s => D = String%> = Integer %%> Common escape%% () no more, no less, one-
- f "{}" braces are generally put the contents of variables, string single quotes '' version 3.6 and above to use
2.while cycle
while 条件:
循环体(死循环)
break(终止当前的循环)
continue (跳出本次循环,继续下次循环)
3. Operator
Arithmetic operators + - * /% (remainder) ** (power) // (divisible)
Assignment Operators
a=1 a+=1 => a=a+1 a-=1 => a=a-1 a*=1 => a=a*1 a/=1 => a=a/1 a**=1 => a=a**1 a%=1 => a=a%1 a//=1 => a=a//1
Logical operators and or not (priority :(), not, and, or)
Comparison operator ==! = (Not equal)> <> = <=
Member operator in not in
4. encoding
ASCII code is not supported by Chinese
GBK (GB) English one-byte Chinese 2 bytes
Unicode (Unicode) English 2 bytes 4 bytes Chinese
utf-8 (the most popular encoding) English 1 byte 2 bytes Europe Asia 3 bytes
Unit conversion:
1B=8b 1024B=1KB 1024KB=1MB 1024MB=1GB 1024GB=1TB