I'm working with a Dictionary of Dicts. Something like this:

myDict = {
                                                'TestName': {
                                                                'FileName':{
                                                                                
'ct_init':1234,
                                                                                
'psl_init':5678,
                                                                                
'total_test_time':7890,
                                                                                
'psl_shutdown':8765,
                                                                                
'ct_shutdown':9021,
                                                                                
'total_time':3421,
                                                                },
                                                }
}

Accessing values is pretty straightforward (nice change from my Perl days). For 
example:

myDict['TestName']['FileName']['ct_shutdown']

in Python interpreter yields

9021

However, when I try to add, let's say, a new FileName entry, I end up replacing 
the previous FileName entry.

In Python interpreter, I try:

myDict['TestName'] = {'NewFileName': {}, }

I get

{'TestName': {'NewFileName': {}}}

So, how do I add a new entry without replacing the old entry?

Thanks

John Townsend (5-7204),
AGM-FL and PSL QE Lead



--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to