join and split

1) join () is converted into a list of strings. Front jion to add '' which is what you what to splice

a=['a','s','f']
b=''.join(a)
print(b)===asf

2) split () cutting. String side field list

= A '= leaving card ah = = received, but refuse to'
B = a.split ( '=')
Print (B) == [ 'leave', 'card', 'received ah', 'but to the trash ']

3) Delete the problem

list and dict

Delete list can not be deleted directly in the loop

dict not change in the cycle length and size

The need to delete the contents kept in a list circulating this new list to delete the old list

4) set collection

Not repeat, disorderly, content hash, the most useful is repeated

5) formkes (a, b) to each element in a acquired and assembled into a new b dictionary returns

6) the depth of copies

Assignment: do not create a new object, both variables refer to the same object

Shallow Copy: Copy the contents of the first layer, to create a new object [:] Copy ()

Deep Copy: copy all the contents of all current and associated objects. deepcopy ()

Guess you like

Origin www.cnblogs.com/yangguogui/p/11259481.html