立即学习:https://edu.csdn.net/course/play/26755/340132?utm_source=blogtoedu
如何切片生产器:
from itertools import islice
gen = iter(range(10))
for i in islice(gen, 2, 6):
print(i)
"""结果:
2
3
4
5 """
立即学习:https://edu.csdn.net/course/play/26755/340132?utm_source=blogtoedu
如何切片生产器:
from itertools import islice
gen = iter(range(10))
for i in islice(gen, 2, 6):
print(i)
"""结果:
2
3
4
5 """