List - Method

The string list (string) to be obtained as a character string for each element of the list

 

+ Number list by two splicing of the same type but if

 

A list of elements can be increased by a multiplication sign

 

Index - (Start position: End position: Each time interval)

 

method--

List name [index] = value you want now - to modify the list

 

del list name [index] - delete the list (can delete the whole list)

 

List name [index:] end position - a plurality of elements assignment (can be the same two indexes, specified location to add elements)

 

List name .append (insertion elements) - add an element to the end of the list

 

List name .clear - clear the list of all elements

 

Name = new list List name .copy (want to copy the list name) - copy of the list operations

 

List name .count ( 'element') - Gets the specified number of elements that appear from

 

List name .extend (another list) - Add another list of things to the end of the list

 

List name .index (elements specified) - Gets the index of the first occurrence of the specified element of (if not, it will error)

 

List name .insert (insert position of the element, the element) - specifies the location of the insert elements list

 

List name .pop (index (the default is the last one)) - elements that were removed or deleted at the end of the specified element

 

List name .remove (element) - According to the element name to remove elements (only removes a forward-most)

 

List name .reverse () - perform reverse order according to the original sort the list (directly modify the list)

 

List name .sort () - sorted according to the size (directly modify the list can be sorted using flashbacks)

 

Guess you like

Origin www.cnblogs.com/nuto/p/10987789.html