Re: iter with stepsize

2008-10-15 Thread Alan G Isaac
Alan G Isaac <[EMAIL PROTECTED]> writes: If I have a sequence, I can get every other or every fifth element by slicing. Is there an equivalent for iterators? On 10/15/2008 11:12 PM Paul Rubin apparently wrote: itertools.islice Oh, of course. I'm a bit embarrassed not to have thought to lo

Re: iter with stepsize

2008-10-15 Thread Paul Rubin
Alan G Isaac <[EMAIL PROTECTED]> writes: > If I have a sequence, I can get every other or every fifth > element by slicing. Is there an equivalent for iterators? itertools.islice -- http://mail.python.org/mailman/listinfo/python-list

iter with stepsize

2008-10-15 Thread Alan G Isaac
If I have a sequence, I can get every other or every fifth element by slicing. Is there an equivalent for iterators? More specifically, I want every fifth line of a big file. What is the most efficient way to get them? Thanks, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list