Skip to main content

A library that clumps up general useful use cases for string prettifying

Project description

SPrettify

A Python module for formatting and structuring strings efficiently. SPrettify helps in creating visually appealing output with alignment, headers, and a clean key-value pairs.

Features

  • Add formatted headers with horizontal tabulation.
  • Append lines with custom alignments.
  • Create structured key-value pair outputs.
  • Print or retrieve the formatted output as a string.

Installation

This module does not require any external dependencies. Just do pip install SPrettify and import it into your project.

Usage

from SPrettify import Prettify

formatter = Prettify()
formatter.define_alignment(spaces=4)  # Set left alignment

formatter.add_tab("Header", "=", 40)
formatter.add_line("This is a formatted line.")
formatter.add_sort("Key", "Value")

formatter.prettyprint()  # Print output
formatted_string = formatter.prettystring()  # Get output as a string

Methods

define_alignment(spaces=0, tabs=0)

Sets the left alignment with spaces or tabs.

add_tab(data="", char="=", lines=30)

Adds a formatted header with horizontal tabulation.

add_line(data="")

Appends a simple line with the defined alignment.

add_sort(key="", value="", separator=":", align=1)

Formats key-value pairs with custom alignment.

prettyprint()

Prints the formatted output.

prettystring()

Returns the formatted output as a string.

Found on

This project is used on GoGoDownloader-R2 It can be used as an example of its usage

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

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

sprettify-0.0.2.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

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

sprettify-0.0.2-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file sprettify-0.0.2.tar.gz.

File metadata

  • Download URL: sprettify-0.0.2.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for sprettify-0.0.2.tar.gz
Algorithm Hash digest
SHA256 d805bcb4d0ec781fad38506b990f2af1b287104269bdb8cefe201cd03417145a
MD5 ac810f372c0c64aa51834b37266b0f38
BLAKE2b-256 31b64e0331cc350e923a777d499cbcb350c83d20b74e47a274269229fe118266

See more details on using hashes here.

File details

Details for the file sprettify-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: sprettify-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for sprettify-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 27294f78ad658ee84f7a0d97c5f9e7069e97dcf799b490cc7ad9a73a00097df1
MD5 f29f7822cddbf6c98488d2b4b8088d23
BLAKE2b-256 8d0134a649a9b322ce4aa4ab3120287910de14179b72758d6f71b2aa084065f2

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