Since this is a top google hit, it's probably also worth mentioning that the standard "collections" package has a "defaultdict" which provides a more flexible solution to this problem.
You can do neat things, for example:
twodee = collections.defaultdict(dict)
twodee["the horizontal"]["the vertical"] = "we control"
Read more: http://docs.python.org/2/library/collections.html