The Wayback Machine - https://web.archive.org/web/20201026092807/https://github.com/TwoWater/Python/issues/57
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python 迭代器 -元组 #57

Open
zyxzhangyuxia opened this issue Aug 27, 2020 · 0 comments
Open

python 迭代器 -元组 #57

zyxzhangyuxia opened this issue Aug 27, 2020 · 0 comments

Comments

@zyxzhangyuxia
Copy link

@zyxzhangyuxia zyxzhangyuxia commented Aug 27, 2020

3、tuple(元祖) 对象创建迭代器

tuple1 = ( 1,2,3,4 )
iter3 = iter ( tuple1 )

next() 函数遍历迭代器

while True :
try :
print ( next ( iter3 ) )
except StopIteration :
break

这个代码的实际运行效果是:1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1。请看看是不是循环条件有问题。谢谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.