📜  python 从生成器中获取所有项目 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:05.440000             🧑  作者: Mango

代码示例1
>>> 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]