On 09/06/2022 12.52, Chris Angelico wrote:
On Fri, 10 Jun 2022 at 03:44, Dave <d...@looktowindward.com> wrote:

Before I write my own I wondering if anyone knows of a function that will print 
a nicely formatted dictionary?

By nicely formatted I mean not all on one line!


https://docs.python.org/3/library/pprint.html

from pprint import pprint
pprint(thing)

 >>> from pprint import pprint
 >>> d = {'two':2, 'three':5}
 >>> pprint(d)
 {'three': 5, 'two': 2}
 >>>

This is all on one line. That might be acceptable to the OP, but it
doesn't actually match what he said.

--
Michael F. Stemper
Outside of a dog, a book is man's best friend.
Inside of a dog, it's too dark to read.
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to