LISTS: Extract every other element
Skip Montanaro
skip at mojam.com
Thu Dec 16 13:52:41 EST 1999
Randall> I want to take a large list:
Randall> [ 1,2,3,4,5,6,7,... ]
Randall> and build a list with every other element:
Randall> [ 1,3,5,7,... ]
Randall> Is there a faster way than looping over indices?:
I'm pretty sure you can do this with NumPy. I'm not a NumPy user though, so
I'll have to defer to the rocket scientists... ;-)
Skip Montanaro | http://www.mojam.com/
skip at mojam.com | http://www.musi-cal.com/
847-971-7098 | Python: Programming the way Guido indented...
More information about the Python-list
mailing list