Differences & Coding & Decodes of T4 IS and ==

One: the difference between is and ==

1. is compare memory address

1)id() ---- get memory address

2 )Small data pool:

a. The small data pool range of numbers is -5 ~ 256

b. String:
         The string cannot contain special symbols +-* / @ Etc.
The memory address within a single character*20 of the string is the same, and the memory address above a single character*21 is inconsistent

Note: In pycharm, All the same strings in a py file generally use the same memory address

2. == compare the values ​​of the two sides

Two: Encoding and Decoding

encode (encoding method) ---- get the corresponding byte after plain text encoding

decode (encoding method) ----- decode the encoded byte into corresponding plain text

  Note: Whatever is used for encoding, what is required for decoding


ps:
ascii Code: Chinese is not supported. English numbers and symbols are 8 bits and one byte. GBK code. National standard: Chinese, English, numbers, and symbols are supported. English 16 bits and 2 bytes. Chinese 16 bits and 2 bytes. Unicode. Symbol English 32 bits four bytes Chinese 32 bits four bytes utf-8 Variable-length universal codes use at least 8 bits English 8 bits one byte Chinese 24 bits three bytes Python3 uses unicode in the program operation stage Display all content bytes type transmission and storage are using bytespycharm storage, the default is to use utf-8

Leave a Comment

Your email address will not be published.