looping through values in a dictionary and appending to a list
Krishna Pacifici
pacificik at warnell.uga.edu
Tue Aug 11 14:17:15 EDT 2009
Nevermind,
got it.
Sorry.
>>> Krishna Pacifici 08/11/09 2:12 PM >>>
Hi,
I want to append the values of a dictionary to a list. I have a dictionary sec_dict_clean and I want to append the values to a list, but am having a hard time looping through the values in the dictionary.
I have tried something like this:
lista=[]
for i in sec_dict_clean.values():
for j in sec_dict_clean.values()[i]:
lista.append(sec_dict_clean.values()[i])
But I keep on getting an error:
TypeError: list indices must be integers
Any ideas on how to loop through values in a dictionary?
Thanks,
Krishna
<pacificik at warnell.uga.edu></pacificik at warnell.uga.edu>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090811/24ed1b89/attachment.html>
More information about the Python-list
mailing list