Problem : Generator

dieter dieter at handshake.de
Sat Feb 16 01:47:02 EST 2019


Prahallad Achar <acharbly at gmail.com> writes:

> I get list object instead gen  obj

If you have a list "l" and want a generator, you can use
   ( x for x in l)
or simpler "iter(l)" - which gives you an interator over "l".

An "iterator" is slightly more general than a generator
(every generator is also an iterator).







More information about the Python-list mailing list