Skip to main content

A Modern Python Pretty Printer

Project description

PyPrnt

Build Status PyPI version

PyPrnt helps you to print a list or a dictionary in an organized table form.
Just try it out!
Don't use print() anymore. Use prnt() for the rest of your life :)

How to install

# If you have both Python 2 and 3,
pip3 install pyprnt
# If you only have Python 3,
pip install pyprnt

How to use

from pyprnt import prnt

creation = ["Adam", "Eve"]
menu = {
    "Kimchi": 5000,
    "Ice Cream": 100
}
print(creation)
prnt(creation) # Magic!
print(menu)
prnt(menu) # Magic!

You should see this...

['Adam', 'Eve']
┌─┬────┐
│0│Adam│
│1│Eve │
└─┴────┘
{'Kimchi': 5000, 'Ice Cream': 100}
┌─────────┬────┐
│Kimchi   │5000│
│Ice Cream│100 │
└─────────┴────┘

And more...

enable: bool (default: True)

Enable prnt() form.

prnt(creation, enable=False)
['Adam', 'Eve']

both: bool (default: False)

Print in both original print() form and prnt() form.

prnt(creation, both=True)
['Adam', 'Eve']
┌─┬────┐
│0│Adam│
│1│Eve │
└─┴────┘

truncate: bool (default: False)

Truncate output values if they exceed the maximum width of Terminal.
The maximum width of Terminal is 50 in this example.

# truncate = False
prnt(["abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz", 12345678910])
# truncate = True
prnt(["abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz", 12345678910], truncate=True)
┌─┬──────────────────────────────────────────────┐
│0│abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrst│
│ │uvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmn│
│ │opqrstuvwxyz                                  │
│1│12345678910                                   │
└─┴──────────────────────────────────────────────┘
┌─┬──────────────────────────────────────────────┐
│0│abcdefghijklmnopqrstuvwxyzabcdefghijklmnopq...│
│1│12345678910                                   │
└─┴──────────────────────────────────────────────┘

width: int (default: current Terminal width or 50)

Set the maximum width of Terminal.

prnt(["Kevin"], width=5)
┌─┬─┐
│0│K│
│ │e│
│ │v│
│ │i│
│ │n│
└─┴─┘

sep: str (default: '')

Put a separator between each input.

prnt("010", "8282", "8282", sep="-")
010-8282-8282

end: str (default: '\n')

Put at the end of an output.

prnt(creation, end="")
prnt("The force is with me")
┌─┬────┐
│0│Adam│
│1│Eve │
└─┴────┘The force is with me

Author

Kevin Kim
Website GitHub LinkedIn

Project details


Download files

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

Files for pyprnt, version 1.2.6
Filename, size File type Python version Upload date Hashes
Filename, size pyprnt-1.2.6-py3-none-any.whl (5.1 kB) File type Wheel Python version py3 Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page