Rene Pijlman wrote:
> dirvine:
>> I would like to create a dictionary based on a variable [...]
>
> And what seems to be the problem?
>
I think that this is his problem:
>>> 'somename'={}
SyntaxError: can't assign to literal
But I'm puzzled why he wants that route, while I'm still pretty new to
programming, I usually smell a design fault when I want to try to
squeeze a literal name into a object variable (am I'm saying this
correct?). Most of the time nesting dictionaries will do the trick for me:
>>> sharedDict=dict()
>>> sharedDict['somename']=dict()
>>> sharedDict['someothername']=dict()
>>> sharedDict
{'somename': {}, 'someothername': {}}
>>>
--
mph
--
http://mail.python.org/mailman/listinfo/python-list