Removing items from a list simultaneously

Ross ross.jett at gmail.com
Tue Apr 21 05:09:12 CEST 2009


Is there a quick way to simultaneously pop multiple items from a list?
For instance if i had the list a = [1,2,3,4,5,6,7] and I wanted to
return every odd index into a new list, my output would be new_list =
[2,4,6] or similarly if I wanted to return each index that was one
away from the midpoint in a, I would get [3,5].



More information about the Python-list mailing list