>>> list1 = list('abcde')
>>> list1.append('fg')
>>> list1
['a', 'b', 'c', 'd', 'e', 'fg']
>>> list1.insert(0,'M')
>>> list1
['M', 'a', 'b', 'c', 'd', 'e', 'fg']
>>> list1.insert(3,'N')
>>>> list1
['M', 'a', 'b', 'N', 'c', 'd', 'e', 'fg']
>>> list1.extend(range(4))
>>> list1
['M', 'a', 'b', 'N', 'c', 'd', 'e', 'fg', 0, 1, 2, 3]
>>> list1.pop()
3
>>> list1.pop(2)
'b'
>>> del list1[1]
>>> list1
['M', 'N', 'c', 'd', 'e', 'fg', 0, 1, 2]
>>> cmp(range(10),range(2,12))
-1
>>> cmp([1,2,3],[2])
-1
>>> cmp([2,1,1],[0,1,1,3])
1
>>> cmp([1,2],[1,2])
0
>>> list1.index(1)
7
>>> list1.index('aa')
Traceback (most recent call last):
File "", line 1, in
list1.index('aa')
ValueError: 'aa' is not in list
>>> list1.count('2')
0
>>> list1.remove(222)
Traceback (most recent call last):
File "", line 1, in
list1.remove(222)
ValueError: list.remove(x): x not in list
>>> list1.remove('fg')
>>> list1
['M', 'N', 'c', 'd', 'e', 0, 1, 2]
>>> list1.reverse()
>>> list1
[2, 1, 0, 'e', 'd', 'c', 'N', 'M']
>>> list1.sort(reverse=True)
>>> list1
['e', 'd', 'c', 'N', 'M', 2, 1, 0]