Take the first n items of an iterator

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Sun Jan 4 06:10:05 EST 2009


On Sun, 04 Jan 2009 10:55:17 +0000, Steven D'Aprano wrote:

> I thought there was an iterator in itertools for taking the first n
> items of an iterator, then halting, but I can't find it. Did I imagine
> such a tool, or am I missing something?

`itertools.islice()`

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list