How to efficently build a nested dictionary

Carsten Gaebler cg at
Sat Mar 10 19:26:57 CET 2001

Aahz Maruch wrote:
> >
> >traffic = {dir: {year: {month: {day: 42}}}}
> I think Emile's suggestion to use a single compound key is a good one.
> If that's not sufficient *and* you can use Python 2.0, take a look at
> the dict.setdefault() method.

How could the setdefault() method help me out?


More information about the Python-list mailing list