Hi,

Shaun wrote:
> I'm trying to create a dictionary with lists as the value for each
> key.  I was looking for the most elegant way of doing it... 

from collections import defaultdict

d = defaultdict(list)

d["joe"].append("something")
d["joe"].append("another")
d["jim"].append("slow down, grasshopper")

print d


HTH,
mick.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to