Length of generator output [duplicate]

The easiest way is probably just sum(1 for _ in gen) where gen is your generator.

Leave a Comment