python - delete item from list of tuple by index -


this question has answer here:

i want delete elements list of tuple given index values.

input: [(1, 2), (3, 4), (5, 6), (7, 8), (9, 10)]

task done:
delete item @ given index: 2,3

desired output: [(1, 2), (3, 4), (9, 10)]

i have tried following code it:

list(numpy.delete(input, [3,2]))   

but got following output: [1, 2, 5, 6, 7, 8, 9, 10]

kindly suggest me possible ways solve case.

list.pop() remove selected elements. have done in reverse order not modify position of later ones.

list.pop(3) list.pop(2) 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -