Python 1-16 bytes

bytes

After Python3, string and bytes types are completely separated. Strings are processed in units of characters, and the bytes type is processed in units of bytes.

The bytes  data type is basically the same as the string data type in all operations, usage and even built-in methods, and it is also an immutable sequence object.

The bytes  object is only responsible for recording the object to be recorded in the form of a binary byte sequence. As for what the object represents (such as what character it is), it is determined by the corresponding encoding format decoding. In Python3, bytes are usually used for network data transmission, storage of binary images and files, and so on. You can generate an instance of bytes by calling bytes(), and its value is in the form of b'xxxxx', where'xxxxx' is one or more escaped hexadecimal strings (the form of a single x is:, \x12where \x is lowercase A sequence of hexadecimal escape characters, 12 is a two-digit hexadecimal number), each hexadecimal number represents a byte (eight-digit binary number, value range 0-255), for the same If the string uses a different encoding method to generate bytes

Guess you like

Origin blog.csdn.net/weixin_43955170/article/details/112720435