Friday, June 22, 2012

Some list functions in jython


Some list functions

Method
Description
mylist.append(x)
Adds an element at the end of the list
mylist.sort([function])
Sorts the list with the optional [function] comparison function
mylist.reverse()
Reverses the list (from last to first)
mylist.index(x)
Seeks the index x
mylist.insert(i, x)
Inserts x at index i
mylist.count(x)
Returns the number of occurrences of x in the list
mylist.remove(x)
Deletes the first occurrence of x in the list
mylist.pop([i])
Deletes and return the last element in the list or the element at index i

No comments:

Post a Comment