Summarize the difficulty of comparing abstract:
1. Binary operations
& 13 =12
60 | 13 =61
60 ^ 13 =49
60<<2 =240
60>>2 =15
2. Logical operators
And Or not
3. Relational operators
In No in
4. Validation operators
Is isn't
5. Character encoding
ASCII uses only 8bit, that is, 1byte can only represent 255 characters, and is sufficient for Europe and the United States. But other non-English language languages cannot include, for example, China's gb2312, and countries have their own standards.
Therefore Unicode appears, can include all countries encoded text, usually 2bytes, special needs 4bytes.
Finally utf-8 in the spirit of saving, combined with ASCII and Unicode, is a variable length code, is also common to all of us.
Ascii->unicode->utf-8
Note: In computer memory, Unicode is used uniformly and is converted to utf-8 when it needs to be saved to the hard disk or transmitted.
When editing with Notepad, the UTF-8 characters read from the file are converted to Unicode characters into memory, and when the edits are complete, the conversion of Unicode to UTF-8 is saved to the file.
ASCII conversion warrants for Python:
>>> Ord (' A ')
65
>>> Chr (65)
A
python2.7 can be used in
>>> u ' abc '. Encode (' Utf-8 ') #unicode---Utf-8
' ABC '
>>> ' abc '. Decode (' Utf-8 ') #utf-8---Unicode
U ' abc '
Unicode is used uniformly in python3.x, plus no U is the same, only the string in bytes must be preceded by B, i.e. B "ABC"
>>>a= ' Tom '
>>>a.encode (' Utf-8 ')
B ' Tom '
>>> a= ' China '
>>> A
China
>>> a.encode (' Utf-8 ')
B ' \XE4\XB8\XAD\XE5\X9B\XBD '
6.list list (Python's fine with)
namelist=[' Tom ', ' Apple ', ' cat ', ' Tom '
Dir (namelist)
Namelist.append (' Tom ')
Namelist.index (' Tom ')
Namelist.count (' Tom ')
Namelist.remove (' Tom ')
Namelist.sort ()
Namelist.reverse ()
Namelist.pop ()
Namelist.insert (2, ' Tom ')
Namelist.clear ()
namelist[:]
Namelist.extend (Otherlist)
If ' Tom ' in NameList:
Print (' OK ')
For I in range (Namelist.count (' Tom ')):
Namelist.remove (' Tom ')
Python3-day1 (basic summary)