S
sfo
how do i create a hash of hash similar to perl using dict in python
$x{$y}{z}=$z
thanks.
--RR
$x{$y}{z}=$z
thanks.
--RR
sfo said:how do i create a hash of hash similar to perl using dict in python
$x{$y}{z}=$z
'My value'x = {'y': {'z': 'My value'}}
x['y']['z']
how do i create a hash of hash similar to perl using dict in python
$x{$y}{z}=$z
$x{$y}{z}=$z
>>> x = {}
>>> y = 42
>>> z = 'foonting turlingdromes'
>>> x[y] = {}
>>> x[y][z] = 'crinkly bindlewurdles'
Tim said: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:
{42: {'foonting turlingdromes': 'crinkly bindlewurdles'}}
-tkc
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.