Answers for "python get all items from generator"

0

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]
Posted by: Guest on May-07-2021

Code answers related to "python get all items from generator"

Python Answers by Framework

Browse Popular Code Answers by Language