How to retrieve an objects content

Adrian Eyre a.eyre at optichrome.com
Tue Mar 21 06:40:35 EST 2000


> I would like to get an objects content into a string. (Like the 
> python print command) The print command uses PyFile_WriteObject
> which is quite unhandy. Any ideas?

PyObject_Str(), or PyObject_Repr() should do the trick. See:

http://www.python.org/doc/api/object.html

You'll also need to convert from a Python string to a C string.
For that you'll need PyString_AsString(). See:

http://www.python.org/doc/api/stringObjects.html

-----------------------------------------------------------------
Adrian Eyre <a.eyre at optichrome.com> - http://www.optichrome.com 





More information about the Python-list mailing list