I wanted to know if the functionality i am trying to implement in python is possible.
I have a global hash called Creatures. Creatures contain sub-hashes called mammals, amphibians, birds, insects.
Mammals have sub-hashes called whales, elephants. Amphibians have sub-hashes called frogs, larvae. Birds have sub-hashes called Eagle, parakeet. Insects have sub-hashes called dragonfly, mosquito.
Again, Eagles have sub-hashes called male, female.
I am counting the frequencies of all these creatures from a text file. For example, if the file is in below format:
Birds Eagle Female
Mammals whales Male
Birds Eagle Female
I should output Creatures[Birds[Eagle[Female]]] = 2
Creatures[mammals[Whales[Male]]] = 1
Is it possible in Python? How can it be done? I am very new to Python and please help is much appreciated. I am comfortable with dictionaries only upto 1 level, i.e. key-> value. But here, there are multiple keys and multiple values. i am not sure how to proceed with this. I am using python 2.6. Thanks in advace!