Assignments and Variable Substitution

srage crodetsky at gmail.com
Mon Aug 13 13:10:18 EDT 2007


On Aug 13, 1:00 pm, brad <byte8b... at gmail.com> wrote:
> I'd like to do something like this:
>
> var = '123'
> %s = [], %var
>
> So that, in the end, var is '123' and an empty list is named '123' as
> well. The list assignments are created during a loop.
>
> Thanks,
> Brad

You probably want to use a dictionary to store your lists... code
like:

variableDict = {}
variableDict[var] = ['value1', 'value2', 'value3']




More information about the Python-list mailing list