Python iter() FunctionPython Functions

Difficulty Level:
Difficulty Level:

The iter() function returns the iterator object.

Example

#!/usr/bin/python3
# -*- coding: UTF-8 -*-

x = iter(["A", "B", "C","D","E","F"])
for i in iter(x):
    print(i)

Output:

A
B
C
D
E
F

Syntax

iter(object)

Parameters

Name Description
object An iterable object

Return Value

It returns an iterator object.

Advertisement

© 2021 Pythonexample.org, all rights reserved. Privacy Policy | Contact Us