Skip to main content

A package for formating titles/tabels/dicationaries/.. into neatly structed text.

Project description

SamsPrettyPrint

Many useful functions to format text neatly.

Installation

pip install SamsPrettyPrint

Use

Import within python like so:

from src.SamsPrettyPrint import print_title, print_table, print_dict, ex_df, ex_dict

# Title
print_title("Title")

# Table
print_table(
    column_headers=ex_df.columns,
    rows=[row for _, row in ex_df.iterrows()]
)

# Dictionary
print_dict(
    ex_dict,
    key_title='Country',
    value_title='Area (km^2)'
)

The package provides a console script called spp.

spp "Title" -p % -f 3
Option Description Default
-f, --format Output level. Choices ['1', '3', '5']. '3'
-p, --prefix Prefix printed before each line. '%'
-v, --version Show the version of SamsPrettyPrint.

Examples

//==================================================\\
||                     Example                      ||
\\==================================================//

Surname     Forename    Born         Years   Nationality   Known for                                    
---------   ---------   ----------   -----   -----------   ---------------------------------------------
Descartes   Rene        1596-03-31   53      French        ('Cartesian coordinates', 'cogito, ergo sum')
Newton      Isaac       1643-01-04   84      British       ('Gravity', 'Calculus', 'Principia')         
Euler       Leonhard    1707-04-15   76      Swiss         ('Graph theory', 'topology', 'exponential')  
Gauss       Johann      1777-04-30   77      German        ('Normal distribution', 'Lens', 'Ceres')     
Hilbert     David       1862-01-23   81      German        ('Hilbert space', 'Set theory')              
Russell     Bertrand    1872-05-18   97      British       ('Paradoxes', 'Principia Mathematica')       
Nash        John        1928-06-13   86      American      ('Game theory', 'Nash equilibrium')       

Authors

Name Email
Samuel Ward samuelwarda1@gmail.com

Project details


Download files

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

Source Distribution

samsprettyprint-2025.0.3.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

samsprettyprint-2025.0.3-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file samsprettyprint-2025.0.3.tar.gz.

File metadata

  • Download URL: samsprettyprint-2025.0.3.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.1

File hashes

Hashes for samsprettyprint-2025.0.3.tar.gz
Algorithm Hash digest
SHA256 dbcd48ea210e0504e39ac69ab821c5531eba11dd5fda51810654296d346095ab
MD5 cfc89cb8060068c1a3ccba7adae716cd
BLAKE2b-256 6462b58306af5877bd4b1788e977bd3bf033a6d8f8bfa3968d2f5d71a938f1b5

See more details on using hashes here.

File details

Details for the file samsprettyprint-2025.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for samsprettyprint-2025.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 62227dea7d423bbf1931aedaae800905278c28a025b3e42365e54ee505b6f541
MD5 adf13f1cbb5d66b9be96e71f7a0c07da
BLAKE2b-256 40204d699a953bd386ad7f8ffd47b1dca046e2b932cada2bdb0ddf83430d87f9

See more details on using hashes here.

Supported by

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