1. Integers:
Hexadecimal prefix: 0x, with 0-9 and a-f to represent numbers. Example: 0xff00
2. Floating-point number: Because when represented by scientific notation, the decimal point position of a floating-point is variable, so it is called a floating-point number.
For a large number, the 10 is replaced by E, 1.24x10 9 times is 1.24e9,0.00012 written 1.2e-5
PS: integer arithmetic is always accurate (division is also accurate!) ), and the floating-point operation may have rounding errors.
3.
Escape character: \ (followed by the character to be escaped, to itself \ can also be escaped)
>>>Print('i\ ' m ok! "' )I'm ok!
Line break: \ n
tab: \ t
>>>Print('\\\n\\') \
Python also allows strings that are inside the "plus r" to be escaped by default:
Print ('\\\t\\') \ Print (R'\\\n\\') \\\n\>>>
If there is a lot of line wrapping inside the string, \n
writing in one line is not good to read, in order to simplify, the "..." format for multiple lines of content:
Print ("'line1 ... line2 ... line3") Line1line2line3 # in fact, when you write the return line will automatically add ..., notice ... is a prompt is not part of the code
4. NULL: The null value is a special value in Python, expressed in None
. None
cannot be understood as 0
, because 0
it is meaningful, and None
is a special null value.
5. Understand the representation of variables in computer memory when writing:
A='ABC'
The Python interpreter did two things:
A string is created in memory ‘ABC‘
;
Creates a variable named in memory a
and points it to the‘ABC‘
6. In Python, the return of the expression 0.1+0.2==0.3 is false (that is, 0.1+0.2!=0.3)
>>> 0.1+0.2==0.3False>>> 0.1+0.20.30000000000000004>>> 0.2+0.30.5
7. Note that the expression output is different
is btrue is Bfalse
Python (data types and variables)