Road python learning (b) list, dict, set the correlation function

A, list []

1.len (xxx)

Gets the number of elements in list

2.xx.append('xxx')

Add elements to the end

3.xx.insert (position, 'xxx')

The element into position to develop

4.xx.pop ([position])

To delete an element or elements at the end of the specified position

5.xx.sort( ) or sort(xx,xx,,,,)

Sequence

Some functions can use rules to sort, such as a key, recover

6.list( )

The iterator into a list

Sequence

Two, dict {:,:}

1.  'xx'  in   xxx

Xxx xx is determined in the presence or absence of

2.xxx.get(xx)

Xxx xx is determined in the presence or absence of

3.xxx.pop(key)

Delete key

Three, set ([])

1.add(x)

Adding elements

2.remove(x)

Removing elements

3、|   &  

Or

 

 

 

Published 55 original articles · won praise 40 · views 210 000 +

Guess you like

Origin blog.csdn.net/hrainning/article/details/81119517