gather information from various files efficiently

Kent Johnson kent3737 at yahoo.com
Tue Dec 14 11:56:10 CET 2004


Keith Dart wrote:
> try:
>     dict[a].append(b)
> except KeyError:
>     dict[a] = [b]

or my favorite Python shortcut:
     dict.setdefault(a, []).append(b)

Kent



More information about the Python-list mailing list