hash of hashes

Ant antroy at gmail.com
Tue Jul 11 15:53:49 EDT 2006


sfo wrote:
> how do i create a hash of hash similar to perl using dict in python
> $x{$y}{z}=$z

Haven't done any Perl in a long while (thankfully ;-) ) so I'm not
quite sure on your syntax there, but here's how to do it in Python:

>>> x = {'y': {'z': 'My value'}}
>>> x['y']['z']
'My value'

Much easier to understand than that crazy perl syntax!




More information about the Python-list mailing list