count

Paul Rubin http
Wed Jul 8 14:43:19 EDT 2009


Bearophile <bearophileHUGS at lycos.com> writes:
> >     print x, len(tuple(g))
> 
> Avoid that len(tuple(g)), use something like the following

print x, sum(1 for _ in g)



More information about the Python-list mailing list