[Tutor] Iterating over nested lists part2

Luis N tegmine at gmail.com
Sat Jul 2 21:04:29 CEST 2005


Okay,

This works great now:

def listItems():
l= []
d = {}
for r in range(len(vw)): 
for x in range(lt):
ed = desc[x] 
exec("d['%s']=vw[%d].%s" % (ed,r,ed))
l.append(d)
print l

But, it multiplies all of the records from vw by 5. How can I have:

for each record in the database:
for each column in the record:
do stuff.

Without multiplying the result i.e len(vw) * lt

Thanks.

Luis N.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20050702/d0c84c84/attachment.htm


More information about the Tutor mailing list