On Wed, 11 Jan 2006 15:53:48 -0700, "Livin" <[EMAIL PROTECTED]> wrote:
> I need to dynamically create dictionary names using strings input at > the time of creation. These will then be placed into a "Parent" > dictionary. Don't do that. > 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]}] This is a list that contains one item, and that one item happens to be a dictionary. Is this really what you want? > dictDevices[item[0],'dict_'+devDictName] Put the dictionaries you create into another dictionary instead: devDict = { } key = item[5].replace(' ','+') devDict[key] = {'Group':item[2], 'Status':item[3], # etc. } HTH, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list