print names of dictionaries
Scott David Daniels
scott.daniels at acm.org
Wed Apr 26 18:22:21 EDT 2006
BartlebyScrivener wrote:
> This works for now. I just added their names as values:
>
> def printdict(dictionaries=[apps, dirs, sites]):
> for dictionary in dictionaries:
> print dictionary["name"]
> keys = dictionary.keys()
> keys.sort()
> for key in keys:
> if key != "name":
> print key, ":",dictionary[key]
> print '\n',
>
> Thank you both for your help.
You might want to use a key of '_name', or '_name_', because
'name' is a fairly likely name to encounter.
--Scott David Daniels
scott.daniels at acm.org
More information about the Python-list
mailing list