[Tutor] slicing nested lists/dicts/tuples
Luis N
tegmine at gmail.com
Tue Jun 28 21:25:49 CEST 2005
Hi,
>>> l
[{'last': 'Bar', 'first': 'Foo'}, {'last': 'Bar', 'first': 'Foo'}, {'last':
'Bar', 'first': 'Foo'}, {'last': 'Bar', 'first': 'Foo'}]
This is how I imagine it:
for i in l:
for j in l[i]:
for k in l[i][j]:
print k.get('first')
print k.get('last')
Is there a short and sweet way of doing this (that actually works).
Luis.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20050628/7b564469/attachment.htm
More information about the Tutor
mailing list