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                      ||
\\==================================================//

------------------------------------------------ TITLE -------------------------------------------------
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.4.tar.gz (9.0 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.4-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: samsprettyprint-2025.0.4.tar.gz
  • Upload date:
  • Size: 9.0 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.4.tar.gz
Algorithm Hash digest
SHA256 1f8d3c5a5e5bc6fac3838d2bcccf3c3e5a049a5e4a12731013630647a5c4f0f8
MD5 7e3fb0b524179d2e7daeade55e0cfa33
BLAKE2b-256 b70ec3d9d59644ae1b0cfd9549510259939e25e266231c18dd634748bb21519e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for samsprettyprint-2025.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 674aa288012eac07e12ab54f8756940f3902ad041d0cae02320f5d96d4c58274
MD5 67cfb72dc7deb33d0b62630047977c47
BLAKE2b-256 755f33627a2154750ee215b5c61f44b17468b51238e51edd2bd9f0650460555b

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