Python variable as a string

Jake Angulo jake.angulo at gmail.com
Fri Aug 23 07:40:06 EDT 2013


Sorry this is a very basic question.

I have a list *var* which after some evaluation I need to refer to *var* as
a string.

Pseudocode:

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


Basically im evaluating the list *var*, and if true, i want to use *var* as
a string so that i can refer to a key-value pair in *adict *(whose key name
is also var for convenience).
*
*
Or maybe i should do things differently?

Any help and code will be appreciated!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130823/8aec6bda/attachment.html>


More information about the Python-list mailing list