Skip to main content

Easily print a complex data structure for readability

Project description

Prettyprint

Easily print a complex data structure

Support

OS Terminal Support
Linux TTYs Full
Linux Konsole Full
Linux Yakuake Full
Windows Command prompt Part [0]
Windows Powershell Part [0]
Windows Windows Terminal Full
macOS Terminal Full
Code Missing
0 Text colours

Is your terminal not included? Create a PR and add it, along with its support level.

Usage

import prettyprint

"""
prettyprint.pprint(
  data=any,  # Data to print
  indent: int = 4,  # How far indented each list, tuple etc. should be indented
  show_types: bool = False,  # If the type of each item should be shown e.g. <int>
  colour_coded: bool = True,  # If colours should be used to show different types
  cutoff: bool = True,  # If text over multiple lines should be cut off
  debug: bool = False  # Show length of itterables
)
"""

# Enabling debug will automatically enable show_types

prettyprint.pprint(
  {"a": [1, 2], "b": {1.4, False}, "c": [1, 2, [3, (4, 5)]]},
  debug=True
)

"""
<dict | Length: 3> {
    <str | Length: 1> a: <list | Length: 2> [
        <int> 1
        <int> 2
    ]
    <str | Length: 1> b: <set | Length: 2> {
        <bool> False
        <float> 1.4
    }
    <str | Length: 1> c: <list | Length: 3> [
        <int> 1
        <int> 2
        <list | Length: 2> [
            <int> 3
            <tuple | Length: 2> (
                <int> 4
                <int> 5
            )
        ]
    ]
}
"""

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

pineaprint-1.0.3-py2.py3-none-any.whl (5.0 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page