[newbie]Is there a module for print object in a readable format?

Steven D'Aprano steve at REMOVETHIScyber.com.au
Mon Oct 17 09:16:42 EDT 2005


On Mon, 17 Oct 2005 11:31:46 +0200, enrico.sirola_NOSPAM wrote:

>>>>>> "James" == James Gan <ganzhi at gmail.com> writes:
> 
>     James> I want the object printed in a readable format. For
> 
> [...]
> 
>     James> I tried pickled, marshel. They do different work. Is there
>     James> another module which do this kind of job?
> 
> from pprint import pprint
> pprint(object)

I don't think that even comes *close* to what James wants.

py> import pprint
py> pprint.pprint([1,2,3,4,[0,1,2], 5])
[1, 2, 3, 4, [0, 1, 2], 5]


-- 
Steven.




More information about the Python-list mailing list