On 2013-08-23, Jake Angulo <jake.ang...@gmail.com> wrote:
> I have a list *var* which after some evaluation I need to refer
> to *var* as a string.

You must make a str version of var.

> Pseudocode:
>
> var = ['a', 'b' , 'c' , 'd']
> adict = dict(var='string', anothervar='anotherstring')
> anotherdict = dict()
> if <condition>:
>     anotherdict[akey] = adict['var']

anotherdict[akey] = adict[str(var)]

Will actually work, though you might prefer:

anotherdict[akey] = adict[''.join(var)]

Try them out and see.

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

Reply via email to