'pretty print' for built in types

Chris Rebert clp at rebertia.com
Tue Dec 9 10:57:39 EST 2008


On Tue, Dec 9, 2008 at 7:31 AM, Robert Dailey <rcdailey at gmail.com> wrote:
> Hi,
>
> Is there a built in way to 'pretty print' a dict, list, and tuple
> (Amongst other types)? Dicts probably print the ugliest of them all,
> and it would be nice to see a way to print them in a readable way. I
> can come up with my own function to do this, but I don't want to do
> this if I don't have to.

There's the `pprint` module in the std lib:
http://docs.python.org/library/pprint.html

Cheers,
Chris

-- 
Follow the path of the Iguana...
http://rebertia.com

> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list