Problems with debugging Lists

Lie Ryan lie.1296 at gmail.com
Sat Dec 12 10:35:56 EST 2009


On 12/12/2009 8:28 PM, Sancar Saran wrote:
> repr works as you say and I had some complaints, it wont format the output.
> Finding some string in 100 key dictionary in formatted in single line bit
> problematic. Is it any way to format it ?

As has been mentioned, use pprint.pformat() to get what pprint.pprint() 
would print as a str instead of being printed.

> Also, very interesting things are happen.
>
> def debug(self):
>
> 	r = '<pre>'
> 	r += repr(self.data)
> 	r += '</pre>'
>
> 	return r
>
> following code works and does not work ever reload ?
>
> One time work another reload wont work.  What I missing ?

What do you mean by it doesn't work? Does it produce the wrong output? 
What's wrong with the output? Does it raises an error? Are you sure it 
isn't because self.data is empty?

> And is possible to get this ? (I store the environ here)
>
> 	r += repr(self.data['environ']['mod_wsgi.listener_port'])
>
> or similar multi sub level elements ?

python had no problem with that.



More information about the Python-list mailing list