Python‎ > ‎itertools‎ > ‎

itertools.islice()

http://www.adilwaseem.com/

Definition
Return an iterator whose next() method returns selected values from an iterable.

Syntax
itertools.islice(iterable, stop) --> islice object
islice(iterable, start, stop[, step]) --> islice object

Parameters
iterable
start, stop=number

Example
The return is equal to:
import itertools
tuple=(3, 4, 1, 2)
z=itertools.islice(tuple,3)
for value in z: print(value)

>>> 
3
4
1
>>>

Comments