I have two list
a =[72,82,955,55,.....]
and
b=[5,7,8...]
I want to remove the element from a. list b specifies the indexes from where elements to be removed.
Asked
Active
Viewed 41 times
0

Nawaf Momin
- 127
- 1
- 1
- 9
-
3Does this answer your question? [Deleting multiple elements from a list](https://stackoverflow.com/questions/497426/deleting-multiple-elements-from-a-list) – doggie_breath Feb 03 '20 at 12:42
1 Answers
3
You could use a list comprehension in combination with enumerate
method in order to apply condition based on the index
.
result = [item for index, item in enumerate(a) if index not in b]

Mihai Alexandru-Ionut
- 47,092
- 13
- 101
- 128