rtw at rtw.me.uk
Mon Aug 9 21:30:36 CEST 2010
targetsmart wrote in news:cd83533b-f51e-4955-96c5-f8a10185bef1
@i18g2000pro.googlegroups.com in gmane.comp.python.general:
> Right now if I want to dump the contents of a generator object I use ,
> a snip from a bigger block of code..
> while gen: print gen.next()
> except StopIteration:
> print "Done"
> is there a much simpler way ?
print list( gen )
> like for printing list we do
> list = range(10)
> print list
> would print
> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
More information about the Python-list