count

Paul Rubin http
Wed Jul 8 20:43:19 CEST 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