Finding name of variable?

Gardner Pomper gardner at networknow.org
Tue Sep 5 09:49:19 EDT 2006


Hi,

I am writing a specialized xml serialization function, and I would like to
be able to serialize the value of a simple object with the object name as
the tag. For example:

   first_name = 'Fred'

  sXML = my_xml_serializer(first_name)

should result in sXML = '<first_name>Fred</first_name>'

I can get class and field names, but how do I find the name of a simple
variable?

Thanks!

- Gardner
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060905/2ca941b0/attachment.html>


More information about the Python-list mailing list