Directory:
1.
Different character sets the same word stands for different meanings, try to use notpd++to open those garbled characters of the novel, and try to undo it. Byte conversion: binary: 01 10 11) 100 101octal: 01 2 3 4 5 6 7 1016 binary: 01 2 3 4 5 6 7 8 9 10Summary of the system:1. Save data on hard disk: 010101012. READ: 0000000000000110101010101010---the corresponding encoded kanji--xx3. See:-converted completed string10101010 Examples shown in 16 binary:#Binary representation of the current integer, shown with the least number of digits#name = 3#print (Name.bit_length ())##name = 5#v = name.to_bytes (1,byteorder= ' big ')#Print (v)
in-process
2. Basic data type:
-
# Binary representation of the current integer, shown with the least number of digits # name = 3 # print (Name.bit_length ()) ## name = 5 # v = name.to_bytes (1,byteorder= ' big ') # Print (v)
integer
-
=""= []---> empty, False-1,1 can be true, but true is only 1
Boolean value
-String
-
The list ist is a mutable type that can increase the type of the modified string to be immutable, only variables= = before the name =' str ', redo a table to make changes user_list=[' La Satan, ' ' Cheer, ' gift vouchers ']#Appenduser_list.append (' Liu Bei ') print (v) print (' user_list ') list Li= [11,22,33] Append insert Remove Extenddel#InsertAppend Li.append (11111)Print(LI)#Insert the specified locationinsertli.insert (0,1111)Print(LI)#Delete, do not output the deleted valueRemoveli.remove (22)Print(LI)#Extend#Expand the original list, add more than one at a timeLi.extend (['Guoshaolong','Guodamao'])Print(LI)#deldelLi[1]Print(LI) Delete and display the remaining valuesList
-
Tuple tuples#name = (' SSDSDSD ', ' Dsdsds ', ' Dsdsdsds ') #元组是不可变类型, cannot directly append modify the source file#v = name[0]#v = name.count (' Alex ') #寻找有几个alex#v = name.index (' Alex ') #寻找 location#v = name[0:2] #取值#Print (v)name= (' One',' A','223',['SDSD','DSDS','DSDSSD']) name[0]= 123wrong name[3] = [11,22,33] Wrong name[3][1] ='AA'The tuple is not modifiable correctly, but you can modify the value of the list inside the tuplePrint(name)Meta-group
-
Dictionary (unordered) Create dictionary:123 Person= {"name":"Mr.wu",' Age': 18} or person= Dict ({"name":"Mr.wu",' Age': 18}) Common operations: Index new Delete key, value, key value pair loop length#Modifyperson = {"name":"Mr.wu",' Age': 18}person['name'] = 11;Print(person)#del Deletes and outputs the remaining key-value pairsperson = {"name":"Mr.wu",' Age': 18}delperson['name'];Print(person)#Output Lengthperson = {"name":"Mr.wu",' Age': 18}Print(len (person))# forperson = {"name":"Mr.wu",' Age': 18} forIinchPerson :Print(i)Dictionary
-
= {"DDS",'dssdds','sdsdsd',' DSDSSD'} This is called a collection
Collection
5. Class
String (str)
Integer (int)
Listing (list)
Dictionary (DIC)
Tuple (tuple)
Boolean value (BOOL)
6. Common commands
Python section II