hash of hashes

sfo raviram at gmail.com
Tue Jul 11 17:13:42 EDT 2006


Thanks to all for the feedback. it worked.

--RR

Tim Chase wrote:
> > how do i create a hash of hash similar to perl using dict in python
> > $x{$y}{z}=$z
>
> Pretty much the same as in perl, only minus half the crazy abuses
> of the ASCII character-set.
>
> Okay...well, not quite half the abuses in this case...
>
>  >>> x = {}
>  >>> y = 42
>  >>> z = 'foonting turlingdromes'
>  >>> x[y] = {}
>  >>> x[y][z] = 'crinkly bindlewurdles'
>
> Or, if you want to do it in a single pass:
>
>  >>> x = {y:{z:'crinkly bindlewurdles'}}
>  >>> x
> {42: {'foonting turlingdromes': 'crinkly bindlewurdles'}}
> 
> 
> -tkc




More information about the Python-list mailing list