Python Programming - Generators - Discussion

Discussion Forum : Generators - General Questions (Q.No. 25)
25.
In Python, what is the purpose of the itertools.tee() function when used with generators?
It creates a copy of the generator
It splits a generator into multiple iterators
It interleaves values from different generators
It terminates the generator
Answer: Option
Explanation:
itertools.tee() is used to split a generator into multiple independent iterators. Each iterator will yield the same values as the original generator.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.