creating dictionarie names, using variables?

Livin livin at cox.net
Wed Jan 11 17:53:48 EST 2006


I need to dynamically create dictionary names using strings input at the 
time of creation. These will then be placed into a "Parent" dictionary.

I'm new to python, and programming, so please bear with me.

here's my initial thought but I don't think it will work...

item[5]='Kitchen Ceiling Lights'
devDictName = item[5].replace(' ','+')
'dict_'+devDictName = [{'Group':item[2], 'Status':item[3], 
'DimLevel':item[4], 'DeviceName':item[5], 'Location':item[6], 
'HouseCode':item[7], 'LastChange':item[8], 'DeviceType':item[9], 
'CanDim':item[10], 'Values':item[11]}]
dictDevices[item[0],'dict_'+devDictName]


thanks for the help! 





More information about the Python-list mailing list