1. Character encoding
ASCII code: One byte=8 bit, 128 characters in English letter case, Roman character, etc.
GB2312, GBK, GB18030 (China's own) Express Chinese characters, get up early general mobile device support to GB2312
Unicode: Universal code, 2 byte=16 bits representing all characters
UTF-8: A dynamically varying length encoding. Save in English 1byte, Chinese 3byte. Python3 character Set bit UTF-8. Python2 default encoding is ASCII code, if you want to support Chinese characters in Python2, add #-*-coding:utf-8-*-at the top of the code
2. Symbol syntax
A single line in front of the line with #, paragraph comments in a row before the paragraph and after the paragraph with ""
"Can also be used to refer to a paragraph string
Single and double quotes are exactly the same in Python, and special symbols in the referenced content are not escaped. (single quotes are escaped in Bashell)
Referencing a variable in a string, Method 1 uses the + connection
Method 2: Use the placeholder%s to write% after the string (variable name 1, variable name 2) # # #s表示string, D for digital numbers, F for floating-point number floating, percent sign to be the same as variable type, python default Volume types are str, print variable type: print (type (variable name))
Method 3: Use {} After the string to add. Format () For example
Method 4:
Convert variable type int () str ()
Input (' string ') # # #在python27里位raw_input ()
3.getpass Module
Import Getpass
passwd = Getpass.getpass ()
Python Learning Notes _ character encoding