python3 迭代器笔记

#迭代器
import sys
list=[1,2,3,4]
it=iter(list)
while True:
try:
print(next(it))
except StopIteration:
sys.exit()



#迭代器
it=iter(list)

print(next(it))
print(next(it))
print(next(it))
print(next(it))
posted @ 2017-08-03 19:43  糖宝虫  阅读(87)  评论(0编辑  收藏  举报