1.name = "Alex"
Print (ID (name))
Li = [a]
Print (ID (LI))2.is determines the memory addressName1 ="[email protected]"name2="[email protected]"Print(name1 = =name2)Print(name1 isname2)in Pycharm, 2 of the results are true .in the Python small black box, print (Name1 is name2) false 3. Small Data pool
in Pythonint STR has small data poolint-5-----Str
If it's all a string of letters, it's pointing to a memory address
If the number is multiplied by str (single letter), the same memory address is within 20 (inclusive)other data types, there is no small data pool concept4.S1 = "Alex"s2 = "Alex"
Q: Will changing s1,s2 change?
A: strings, tuples, and int are immutable data types. DIC will change. 5.Unicode: Universal code (default = 32 bits is a single character)
a:0000 0001 0000 0001 0000 0001 0000 0001
medium: 0000 0101 0000 0101 0000 0101 0000 0101Upgrade: Utf-8: Use at least 8 Wei to represent one character
a:0000 0001 8-bit
Europe: 0000 0001 0000 0001 16-bit
Medium: 0000 0101 0000 0101 0000 0101 24-bitGBK: GB
a:0000 0001 8-bit
Medium: 0000 0101 0000 0101 16-bit1. Different compilation between each other can not identify the other side of the binary, will error, or generate garbled
2. In your string (file) storage, transfer, you must use a non-Unicode binary (01010101)
6. Data type(1) bytefor non-Chinese: representation: B "Alex"
Internal code: utf-8,gbk,gb2312 ... (Non-Unicode) you set thefor Chinese: representation: B "Xe3\xf2\x36\xe3\xf2\x36\"
Internal code: utf-8,gbk,gb2312 ... (Non-Unicode) you set the(2) Strfor non-Chinese: presentation: "Alex"
Internal code: Unicode
Internal code: Unicode
7. Representation and Conversion
Encode is a representation converted into Utf-8 g format
(1) English representation and conversions ="Alex"b= S.encode ("Utf-8")Print(S,type (s))Print(B,type (b))#(2) Chinese representation and conversions ="I love China"b= S.encode ("Utf-8")Print(S,type (s))Print(B,type (b))
Transfer and storage of Python internal files