Python basics 3

Supplement to Getting Started

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 calculations

16 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.

Four, everything is an object###

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

Python basics
Python basics 2
Python basics
Python basics 3
Python basics 4
Python basics 5
Python object-oriented basics
Python multi-process and multi-thread basics
Python multithreading
Python CookBook
Python FAQ
Python3 dictionary
Python3 module
python (you-get)
Python string
Python descriptor
Python exec
Python notes
Python3 tuple
CentOS + Python3.6+
Python advanced (1)
Python decorator
Python IO
Python multithreading
Python toolchain
Python3 list
Python multitasking-coroutine
Python overview
python introduction
Python analytic
07. Python3 functions
Python multitasking-threads
Python functions
python sys.stdout
python operator
Python entry-3
Centos 7.5 python3.6
Python string
python queue Queue
Learn the basics of python interactive mode
Two days of learning the basics of Python
Centos6 install Python2.7.13
Python answers questions
Python basic syntax (1)
Python exit loop
Ubuntu16 upgrade Python3
Centos7 install Python 3.6.
Python classic algorithm
Relearn ubuntu --python3
Python2.7 [Installation Tutorial]
Python string manipulation
Python 3.9 is here!
Python study notes (1)
python learning route
CentOS7 upgrade python3
Python3 basic syntax
Python review one
linux+ubuntu solve python
Functions in python
Python learning-variable types
CentOS install Python 3.6