iter: Iterator Types : next « Buildin Function « Python






iter: Iterator Types

iter: Iterator Types
D = {'a':1, 'b':2, 'c':3}
x = iter(D)
print x.next()

print x.next()


for key in D: 
     print key, D[key]


           
       








Related examples in the same category

1.next() raises a StopIteration exception tellint the for loop to terminatenext() raises a StopIteration exception tellint the for loop to terminate