how do you print an object?

Thomas Jollans thomas at jollans.com
Fri Jul 9 09:42:44 EDT 2010


On 07/09/2010 03:24 PM, Rene Veerman wrote:
> hi.
> 
> i'm a recent convert from php because google appengine runs python.
> i have a whole cms backend to convert (also to bigtable, but thats
> another story) to python now.
> 
> the first item on my agenda is the printing of python objects to json objects.
> i have this nifty xhtml dataviewer (htmlMicroscope, see the downloads
> page in my signature) that accepts json objects for display in the
> browser. i also have an xhtml error viewer, logAndHandler, that does
> sort of the same.
> i want to use both of these with python, and i will promise to release
> the python sources for hm() and lah() as well.
> 
> so my question is simple: how do you go from python object to json
> representation of that object, preferably keeping everything including
> function code in the json output?

http://docs.python.org/py3k/library/json.html

To get function code, have a look at the inspect module docs.

> 
> i'll have many more questions, if i decide to convert my cms backend to python.
> but it seems i'm without option on this ;)
> 
> side question: anybody know a cloud hosting service that does php? i
> really have a ton of code already ;)
> 
> 




More information about the Python-list mailing list