Chapter 9, Common Functions and Methods in Python (9.4)---bytes type, base, encoding and decoding, encode(), decode()

Catalog
9.4
bytes type, base system, encoding and decoding, encode(), decode() in python
(1) bytes type
(2) encoding standard (encoding table, encoding rules)
(3) base system
(4) encoding and decoding, Method encode(), decode()

9.4 bytes type, base, encoding and decoding, encode(), decode() in python

(1) bytes type

        A bit is the smallest unit of computer storage, abbreviated as b, also known as a bit (bit). In computers, 0 and 1 in binary are used to describe data, and a 0 or 1 represents one bit.

        In a computer, an 8-bit binary is usually used to represent a basic unit of data, and an 8-bit binary is called a byte. Byte is the unit of binary data and the smallest information unit of a computer, which cannot be further divided. That is to say, a byte can represent the meaning of a character and cannot be further divided. A character similar to a string format cannot be divided point.

       Multiple characters can form a string, we can call it a string type, multiple 8-bit binary forms multiple bytes, in python we can call it a bytes type (byte type, byte string).

       Since computers are stored and calculated in binary, and bytes are the smallest information unit of computers, bytes are also used as the basic unit for measuring storage capacity in computers.

       The Bytes type is a data type used to represent binary bytes, similar to the string type used to represent character data types. The bytes type is a data type that describes binary data in units of bytes.

   

Guess you like

Origin blog.csdn.net/thefg/article/details/127987527