list append to list python code example
Example 1: append to lists python
list = ['larry', 'curly', 'moe']
list.append('shemp')
list.insert(0, 'xxx')
list.extend(['yyy', 'zzz'])
print list
print list.index('curly')
list.remove('curly')
list.pop(1)
print list
Example 2: append python
it=[]
for i in range(10):
it.append(i)
Example 3: how to extend an array python
my_list = ['geeks', 'for']
another_list = [6, 0, 4, 1]
my_list.extend(another_list)
Example 4: append to lists python
list = [1, 2, 3]
print list.append(4)
list.append(4)
print list