Objective:
What is code?
Code is the mapping of real-world things in the computer world.
What do you write code for?
Writing code is to describe things in the real world in a computer language.
One, number: shaping and floating-point type
Integral type: int
Float type: float (no single and double precision points)
Special note that 2/2=1.0 get float result 2//2=1 get is int result
Binary, 10, 2, 8, 16
Three, the representation and transformation of the system
OB indicates 2 binary 0B10 =2
0o = 8 binary 0o10=8
0x = 16 binary 0x10=16
Bin () can convert any number of bytes into binary bin (0x10) = ' 0b10000 '
int () converts any number of bytes into a decimal int (0x10) =16
Hex () converts any number of bytes into hex hex (+) = ' 0x10 '
The Oct () can convert any number of bytes into an octal Oct (8) = ' 0o10 '
Iv. Boolean types and complex numbers
BOOL Boolean type: Denotes True and false
Complex complex J denotes 36j
BOOL (0), BOOL ("), bool ([]), BOOL ({}), bool (None) are False
Five, single quotes and double quotes, three quotation marks (in English)
"Let's go" = ' let\ 's go ' = ' Let's Go '
"Content"
Six, escape character
Special characters
Characters that cannot be "seen"
Characters that are conflicting with the language itself syntax
\ nthe line break
\ ' Single quotation mark
\ t Transverse tab
Seven, original string
When an R is prepended to a string, it is not a normal string, but a primitive string
Print (R ' c:\no\nother ') output: C:\no\nother
Eight, string arithmetic
+ string concatenation
* String multiplication ' Hello world ' *2= ' Hello Worldhello world '
String index ' Hello World ' [1] = ' e ' or ' Hello Worldhello world ' [ -5]= ' W '
Intercept string ' Hello World ' [0:2]= ' he '
Basic types of Python