def c():
yield 222
yield 333
a=[1,2,3,4]
b=iter(c,333)
print a,b
for i in b:
print i
how can i get it.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You need to provide the function (which will return the next value) to your
iter()call. In your case, that’sc().nextrather thanc.This snippet below works as expected by producing all the yielded values up to, but exclusive of, the terminating value.
The output of that is: