Python notes,
write in front: Python case-sensitive
1, scientific counting method, the 10 is replaced by E, 1.23x10 9 is 1.23e9
Or 0.00012 is 1.2e-4.
2, the escape character \ or R ' "Equals C # in the @" R for raw string inside the \ Not escaped
To say \ is to write \ \
Line breaks can be "content", or they can be preceded by the R display
Example:
Print ("' 1
2
3 ")
Results: 1
2
3
3, null value with none to indicate
4, Division,/General Division,//floor division reserved integers
5, encoding problem, ASCII "only English encoding", Unicode "encoding of the world-wide language includes: Gb2312,shift_jis,euc-kr" However, UTF-8 "variable length encoding, encoded according to Unicode character length"
6. Common placeholders
%d integers
%f floating Point
%s string
Integer of%x 16 binary
Practice:
#-*-Coding:utf-8-*-s1 = 72s2 = 85r = (s2-s1)/s1*100print (' Xiao Ming boosts the percentage:%.1f%% '% r)
Result: Xiao Ming raised a percentage point: 18.1%
Source: http://www.liaoxuefeng.com/wiki/0014316089557264a6b348958f449949df42a6d3a2e542c000
"Python" data type, string and encoding