Length of generator output [duplicate] November 15, 2022 by Tarik The easiest way is probably just sum(1 for _ in gen) where gen is your generator.