Created
February 22, 2016 15:56
-
-
Save drobati/00ffe2500550a0a0bf31 to your computer and use it in GitHub Desktop.
Return list until match is found
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
list(gen) | |
# ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] | |
items = list() | |
try: | |
while gen: | |
item = next(gen) | |
items.append(item) | |
if item == '4': break | |
except StopIteration: | |
print "log a message" | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks @GrappigPanda