Re: Python variable as a string

2013-08-24 Thread Jake Angulo
Thank you all for the reply. Actually yes this was a confusing question, and borne out of trying to make a shortcut. I didnt ask to convert the contents of var into a string. All I needed was to get the literal equivalent "var" because I needed to use it in another dict object - whose keys i named

Re: Python variable as a string

2013-08-23 Thread Vlastimil Brom
2013/8/23 Jake Angulo : > 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 : > anothe

Re: Python variable as a string

2013-08-23 Thread Steven D'Aprano
On Fri, 23 Aug 2013 21:40:06 +1000, Jake Angulo wrote: > Sorry this is a very basic question. Not so much "basic" as confusing. > 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'

Re: Python variable as a string

2013-08-23 Thread Neil Cerutti
On 2013-08-23, Jake Angulo 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 : >

Python variable as a string

2013-08-23 Thread Jake Angulo
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 : anotherdict[akey] = adict['var'] Basically im