One, bytes type
Two, ternary operation
result =Value 1 if condition else value 2
If the condition is true: result = value 1
If the condition is false: result = value 2
Three, base
Computer memory address and why use hexadecimal?
Why use hexadecimal
1、 Computer hardware is 0101 binary, and hexadecimal is just a multiple of 2, which makes it easier to express a command or data. Hexadecimal is shorter, because a hexadecimal number can be converted to 4 binary digits, which is one byte (8 hexadecimal can be represented by two hexadecimals)
2、 The earliest stipulation that the ASCII character set uses 8bit (expanded later, but the basic unit is still 8bit), 8bit can be directly expressed in 2 hexadecimals, which is more convenient than other hexadecimals for reading and storage
3、 The CPU operation in the computer also follows the ASCII character set and is developing in such a way as 16, 32, 64, so the hexadecimal system is also better when data exchange.
4、 In order to unify the specifications, we see that the CPU, memory, and hard disk all use hexadecimal calculations16 Where is the base used
1、 Network programming and data exchange need to parse the bytes one byte by one byte. One byte can be expressed in two hexadecimals, 0xFF. Through the network capture, you can see that the data is transmitted through hexadecimal.
2、 Data storage, storage in the hardware is 0101, and the expression stored in the system is byte
3、 The definition of some commonly used values, such as the color expression in html that we often use, is in hexadecimal format, 4 hexadecimal digits can express millions of color information.
For Python, everything is an object, and objects are created based on classes
Therefore, the following values are all objects: "wupeiqi", 38, ['Beijing','Shanghai','Shenzhen'], and are objects generated according to different classes.
Recommended Posts