python学习笔记 -- iter(): 手动迭代

scores = [88, 79, 65, 96, 75, 68, 91.5]

#手动迭代: iter(可操作序列), 返回一个迭代器
i = iter(scores)
while True:
    try:
        s = next(i)
    except StopIteration:
        break
    print(s)

操作结果:
88
79
65
96
75
68
91.5

原文地址:https://www.cnblogs.com/DuanLaoYe/p/6756152.html