Created
October 20, 2019 06:32
-
-
Save JackInTaiwan/82596d86fde81005d3f3a4b9cecc21bb to your computer and use it in GitHub Desktop.
python_iteration_6.py
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
x = (i for i in range(2)) | |
print(type(x)) | |
# <class 'generator'> | |
print(next(x)) | |
print(next(x)) | |
print(next(x)) | |
# 0 | |
# 1 | |
# Traceback (most recent call last): | |
# File "/Users/jackcheng/Programming/python/notes/notes_11.py", line 125, in <module> | |
# print(next(x)) | |
# StopIteration |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment