nprint
This is a module providing convenient functions to format, color and print any string to highlight any contained data structures.
It intends to replace the well known pprint, to format python objects on output
from nprint import nprint
data = {
'name': 'mydict',
'comment': 'this is a dictionnary',
'field': (5, 6),
'long one': [12324232, 53445645645, 'truc', 345345345345345356, (456,45), 'bla bla bla', 'blo blo blo', 'things and so'],
'some text': '/!\\ even content of strings are formated:\n {345, 23, 17, [2,1]} as you see\n',
}
installation
using pip:
pip install pnprint
or copy nprint.py from this repo to any directory you want !
functions provided:
-
nprint(*args, indent=0, color=True, end='\n')the pprint replacement: it works as
print()but works on strings instead of working on already known objectsit splits too long lines into indented blocks by syntax markers (such as
{}()[], etc)be careful: as
print,nprintuses the string conversionstr(obj)to convert an object passed, if you want to use the string representation, then you'll have to passrepr(obj)tonprintornformat -
nformat(text, indent=0, width=100) -> strsplit a text into indented lines
-
ncolor(text) -> stradd color makers for terminals syntax highlighting
-
deformat(text) -> strremove formatting of all marker-enclosed text
Metadata
Release files for pnprint 1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pnprint-1.3.tar.gz | 5.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pnprint-1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.9 kB
Release files / pnprint-1.3.tar.gz
| Download URL | pnprint-1.3.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5129681f463914137b62f61124a8bda83eef4d31592bea38db569f9189106047
|
|
BLAKE2b-256 checksum How to use checksums |
9d73e4b8c7b3f7db0878989ec4fe6735369b1bfc995d676de762d6fe9bc75831
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.11.2 Linux/6.1.0-33-amd64
|
Release files / pnprint-1.3-py3-none-any.whl
| Download URL | pnprint-1.3-py3-none-any.whl |
|---|---|
| Size | 6.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
091eced168a39b372895b669f0b960bb8534469641660da20309baa986a60571
|
|
BLAKE2b-256 checksum How to use checksums |
07f2f8242cfb6e4d0d9663c4b028034a43f622b1269d0631d2bab3c2ff6b5a97
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.11.2 Linux/6.1.0-33-amd64
|