Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Python iter() Function

Python iter() Function

Python built-in function Python built-in function


Description

iter() The function is used to generate an iterator.

Syntax

The following is the syntax of the iter() method:


iter(object[, sentinel])

Parameters

Return Value

An iterator object.

Example

lst

=

[

1

,

2

,

3

]

for

i

in

iter

(

lst

)

: ...

print

(

i

)

...

1

2

3

Python built-in function Python built-in function