Q: Name of a arbitary variable as a string?

username username at ilt.fhg.de
Tue Nov 12 15:01:28 EST 2002


Hi! 

Sorry, if this Question was asked a million times!

I am searching for a function (call it: var_name) that do something like
this: 

>>> V="Hello World"
>>> var_name(V)
'V'


I know how to get it from the locals() Dict. but this is not well
defined if I have a second variabe 

>>> T="Hello World" 

Thanks

Marco  
 

------------------------------------------------------------
# Dipl. Phys. Marco Höfer
# Fraunhofer Institut f. Lasertechnik 
# Steinbachstr. 15, D-52074 Aachen, Germany.
# Tel: + 49 (0) 241 8906 128, Fax: +49 (0) 241 8906 121
# EMail: hoefer at ilt.fraunhofer.de, WWW: http://www.ilt.fhg.de



More information about the Python-list mailing list