How to get the 'name' of an int
Hilbert
hilbert at microsoft.com
Fri Feb 28 10:56:49 EST 2003
Hans,
I would solve this problem with using
a dictionary
>>> my_ints={}
>>> my_ints['causea']=12
>>> my_ints['causeb']=13
>>> for i in my_ints:
... print "%s = %d" % (i,my_ints[i])
causea = 12
causeb = 13
Hope this helps.
Hilbert
"I'm new to python so be easy on me!"
"Hans Brand" <Hans.Brand at BrandInnovators.com> wrote in message
news:b3najo$hej$1 at reader08.wxs.nl...
> Hi,
>
> I would like to get the 'name' of a variable to do something like this:
>
> causea = 12
> causeb = 13
> for cause in (causea, causeb):
> print "%s = %s" %(name(cause), cause)
>
> The result should be:
> causea = 12
> causeb = 13
>
> How can I achieve this?
>
> Thanks, Hans
>
>
More information about the Python-list
mailing list