Suggestion/recommendation for dictionary formatting

Skip Montanaro skip at pobox.com
Mon Aug 25 10:45:16 EDT 2003


    John> I've experimented with this and concluded:
    John> {1:2, 3:4, 5:6, 7:8}

    John> is more readable than the current output:

    John> {1: 2, 3: 4, 5: 6, 7: 8}

    ...

    John> Comments anyone?

Have you tried the pprint module?  For small dictionaries it prints the
normal way, but for large dictionaries it prints one element per row.

Skip





More information about the Python-list mailing list