- The first piece of basic knowledge
- Module
- String
- ' x ' anti-quotes (not single quotes ', also available with repr function), can change the value x to a string, for example x=1,print "Hello" +x (Error), print "Hello" + ' x ' (right)
- R-Primitive string, or \ will not be used as an escape symbol, e.g. R "c:\n"
- Chapter II List and Ganso (list can be modified, meta-ancestors can not be modified)
- List x=[' A ', 1] y=[' B ', 2] c=[x,y]
- Index 0-The first one represents the last
- Shard n=[1,2,3,4,5,6,7,8,9,10] X=n[1:4] (the first element to be displayed subscript: The remaining first element subscript 2,3,4); step X=n[1:9:2] (2,4,6,8)
- Sequence addition a=[1,2,3] b=[4,5,6] a+b=[1,2,3,4,5,6]
- Multiplication a=[1,2,3] a*2=[1,2,3,1,2,3]
- Membership "in" a= "HW" ' W ' in a Returns True, ' R ' in a returns false
Python Basic Tutorial Second Edition reading notes