bob gailer wrote:
>     if key not in keywords:
>        keywords[key] = []
>     keywords[key].append(value)

This can be written more succinctly as
   keywords.setdefault(key, []).append(value)

or in Python 2.5:
from collections import defaultdict
keywords = defaultdict(list)
...
   keywords[key].append(value)

Kent
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to