The data structure of Python

Recommended for you: Get network issues from WhatsUp Gold. Not end users.


The list list, equivalent to Java list. The main methods are as follows: (the copy)


To add an item to the end of the list, the equivalent of a[len(a):] = [x] .


All the elements of a given list are added to another list, equivalent to a[len(a):] = L .

list.insert(i, x)

Inserts an element at the specified location. The first parameter is ready for insertion into the elements of the front of the index, for example a.insert (0, x) will be inserted into the front of the list, and a.insert (len (a), x) equivalent to a.append(x) .


Remove the first item list whose value is x. If no such element, will return an error.


Delete the elements given position in the list, and return it. If you do not specify an index, (a.pop) returns the last element. The element is deleted from the list. Methods I (on both sides of the square brackets denote that the parameter is optional, not ask you to enter the square brackets, you will often encounter such markers in the Python library reference. )


Returns the first value is index x elements in the list. If no matching element will be an error return.


Return the number appears in the list of X.


The elements in the list in sorted.


In situ reverse the elements of the list,.


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Randolph at December 05, 2013 - 1:02 PM