Python List
A quick reference guide.
List reference guide
- list.append(object) #appends object to the end of the list
- list.count(value) #counts the number of apperances of value
- list.extend(iterable)
#appends iterable to the end
- list.extend([1, 2, 3]) results in ['previous list', 1, 2, 3]
- list.extend("shoes") results in ['previous list', 's', 'h', 'o', 'e', 's']
- list.index(value, [start, [stop]]) #returns the first index of value
- list.insert(index, object) #inserts object before index
- list.pop(index) #remove and returns item at index (default last)
- list.remove(value) #remove first occurance of value
- list.reverse() #reverse the list
- list.sort(cmp=None, key=None, reverse=False) #sort the list, default ascending. reverse=True descends the sort