Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python get all items from generator

>>> def get_squares():
...     yield from (num ** 2 for num in range(10))
... 
>>> list(get_squares())
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #items #generator
ADD COMMENT
Topic
Name
5+3 =