Function to Print a nicely formatted Dictionary or List?

Cameron Simpson cs at cskk.id.au
Thu Jun 9 19:12:39 EDT 2022


On 09Jun2022 21:35, Dave <dave at looktowindward.com> wrote:
>I quite like the format that JSON gives - thanks a lot!

Note that JSON output is JavaScript notation, not Python. The `pprint` 
module (which has `pprint` and `pformat` functions) outputs Python 
notation.

If you're just writing for human eyes, JSON is fine, though you will 
want to keep in mind that JSON spells `None` as `null`.

Cheers,
Cameron Simpson <cs at cskk.id.au>


More information about the Python-list mailing list