So I have two lists:
num = [
3, 22, 23, 25, 28, 29, 56, 57, 67, 68, 73, 78, 79, 82, 83, 89, 90, 91,
92, 98, 99, 108, 126, 127, 128, 131, 132, 133
]
details = [
'num=10,time=088', 'num=10,time=084', 'num=10,time=080', 'num=10,time=076',
'num=10,time=072', 'num=10,time=068', 'num=10,time=064', 'num=10,time=060',
'num=10,time=056', 'num=10,time=052', 'num=10,time=048', 'num=10,time=044',
.
.
.
.
'num=07,time=280', 'num=07,time=276', 'num=05,time=508', 'num=05,time=504',
'num=05,time=500', 'num=05,time=496'
]
num
has 28 elements and details
has 134 elements. I want to remove elements in details
by index based on values from num
. For example elements with index 3, 22, 23, 25, 28... (these are numbers from num
list) should be removed from details
.
When I use .pop()
as it is described here it gives me an error saying:
AttributeError: 'str' object has no attribute 'pop'
similarily when I use del details[]
it gives me an error saying:
IndexError: list assignment index out of range
Here is my code:
for an in details:
an.pop(num)