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.3.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.3-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sprettify-0.0.3.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.3.tar.gz
Algorithm Hash digest
SHA256 c6548ce053a00d0d41487a269a19ef55f051e677b2926c72c8124c6bf78b008a
MD5 72fa0b32787b88259078af0c2971b2a2
BLAKE2b-256 24adef8487eee9054eae4e81ba60a9a54912c0fb099ef83cc78dea02e3d30007

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sprettify-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.0 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 21b6744eb0222442b75c86a419767e5c7cea927050cb3475965331008edd3c80
MD5 f46e58075af5848413dc6a5da6c3241f
BLAKE2b-256 856db39f40ef97b153e879f2b040e8cbbd5d3a5bb5db7fac81e6c8d8aa8c84c5

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