On 06/03/12 17:50, Abhishek Pratap wrote:
I am looking for a way to build dictionaries of dict in python.
Thats not a problem, you just nest them:
d1 = {key: value,...} # a single level dictionary
d2 = {key: d1, ...} # a dictionary of dictionaries...
d3 = { key1: {key2: value, ...}, ...} # and on one line
For example in perl I could do
my $hash_ref = {};
$hash->{$a}->{$b}->{$c} = "value";
if (exists $hash->{$a}->{$b}->{$c} ){ print "found value"}
Can I do something similar with dictionaries in Python.
No idea, I haven't done any Perl for over 10 years.
What does that actually do?
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor