picus
0
Q:

remove iwth index list python

myList.remove(item) # Removes first instance of "item" from myList
myList.pop(i) # Removes and returns item at myList[i]
45
>>> a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> del a[-1]
>>> a
[0, 1, 2, 3, 4, 5, 6, 7, 8]
6
>>> del a[2:4]
>>> a
[0, 1, 4, 5, 6, 7, 8, 9]
5
a = ['a', 'b', 'c', 'd']
a.pop(1)

# now a is ['a', 'c', 'd']
1

New to Communities?

Join the community