Six, id small data pool, encoding and decoding.

   asscii : 8 bits (numeric, English, special characters) represent a character.

      A:0000 0001

unicode: (Universal Code) Initial: 16 bits, two bytes, representing two characters.

      A:0000 0001 0000 0001

      Medium: 0000 0001 0001 0000

     Upgrade: 32 bits, 4 bytes represent a character. (a waste of resource)

      A:0000 0001 0000 0001 0000 0001 0000 0001

      Medium: 0000 0001 0001 0000 0000 0001 0001 0001

utf-8: English: 8 bits, one byte represents one character.

      A:0000 0001

        Europe: 16 bits, two bytes represent one character.

      Chinese: 24 bits, 3 bytes represent one character.

GBK (National Standard) (English and Chinese only)

      English: 8 bits, one byte represents one character.

      A:0000 0001

      Medium: 16 bits, two bytes represent one character.

      Medium: 0000 0001 0001 1010

8bit = 1bytes

1024 bytes = 1kb

1024kb = 1MB

1024MB = 1GB

1024GB = 1TB

1024TB = 1PB

 

== is a comparison value.

is compares memory addresses.

View memory address

a = [1, 2, 3, 4]
b = [1, 2, 3, 4]
print(id(a))
print(id(b))
print(a is b)

Small data late:

Number: -5~256 The role is to save memory space.

String: 1 Small data pool does not exist if it contains special characters.

    2 Elements that are not letters. single letter *int (within 20)

 

Data Type Supplement

tu1 = ( ' laonanhai ' ) The data in the tuple has only one element and no comma, then what data type is in his parentheses, which is the data type
tu2 = ( ' laonanhai ' ,)
li= ([1,2,3,4,5])
print(type(li))

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325600504&siteId=291194637