Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
list = [1,2,3,4]
it = iter(list) # this builds an iterator object
print(next(it))
print(next(it))
print(next(it))
it = next(it)
print(it)
try:
it = next(it)
print(it)
except Exception as e:
pass
it = (x for x in range(10))
for i in it:
print(i, end=" ")
print(sum(it))
print(iter(range(1,10)))
Advertisements
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.
AcceptLearn more