[Q/newbie] Converting object names to strings and back?

Adam Twardoch list.adam at twardoch.com
Tue Aug 21 00:32:47 EDT 2001


I'm trying to write the contents of some Python objects to a text file. The
output should look like
objectname + "=" + objectcontents
objectname + "=" + objectcontents

Then, I want to read that file and store the objectcontents in the
respective objects.

My question: how can I determine the name of a particular object, or,
precisely, convert it to a string? And then, when I have a string (for
example "MyObject.property"), how can I make Python find the object with
that particular name?

I know that in Perl, constructs like $$variable can help.

I'm just starting with Python, so please have mercy. And, I must use Py
1.5.2 for Windows.

Thank you in advance,
  Adam





More information about the Python-list mailing list