python--迭代器

挨个访问,直到没有出现StopIteration错误。

while true:

  try:

    each=next(it)

  except StopIteration:

    break

  print(each)

for each in string:

  print(each)

 

posted @ 2018-03-09 22:16  倾城、殇满泪  阅读(100)  评论(0编辑  收藏  举报