Print with auto indentation
Project description
prindent
Python module to print with automatic indentation
Sometimes it is useful to print with indentation to better visualize the data. This is particularly true when multiple for loops and if statements are nested. prindent can automatically indent everything for you.
Usage
from prindent import prindent
prindent('first loop')
for i in range(2):
prindent('i:', i)
prindent('second loop')
for j in range(2):
prindent('j:', j)
if j == 1:
prindent('j=1')
# first loop
# i: 0
# second loop
# j: 0
# j: 1
# j=1
# i: 1
# second loop
# j: 0
# j: 1
# j=1
prindent supports custom indentation strings:
if True:
if True:
for i in range(2):
prindent('Custom indent', indent='---> ')
# ---> ---> ---> Custom indent
# ---> ---> ---> Custom indent
prindent handles multiple lines:
if True:
prindent('String\nwith\nnewline')
# String
# with
# newline
prindent accepts multiple args and kwargs just like print():
if True:
prindent('first', 'second', end='$')
# first second$
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file prindent-1.0.1.tar.gz.
File metadata
- Download URL: prindent-1.0.1.tar.gz
- Upload date:
- Size: 14.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
689798671efcbd04111a4f4a33de4bb8f1f3de0ceb77be0c9d809d15801c4652
|
|
| MD5 |
1a174d886d8c81b81666bf014e6d2d15
|
|
| BLAKE2b-256 |
fdaa7e313b3b9b3d18b44f1658af26f57db6a96ad01b18a9e7e14380c9214df3
|
File details
Details for the file prindent-1.0.1-py3-none-any.whl.
File metadata
- Download URL: prindent-1.0.1-py3-none-any.whl
- Upload date:
- Size: 14.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
404572843076d604cd0ffd38a707f0851204614965599c112c6c6446609e5749
|
|
| MD5 |
c66f335e64ef278cb0058b13725a996f
|
|
| BLAKE2b-256 |
7729fbab8c233ad0d80016f835d8757b32ee4e60c5158a2afe2e01a615dac3ee
|