Skip to main content

A short description of print9

Project description

print9

An upgraded, drop-in replacement for Python's print with:

  • Line wrapping via wrap (per-object wrapping at a given width)
  • ANSI coloring via color (predefined names or custom ANSI codes)
  • Full compatibility — forwards standard print() kwargs like sep, end, file, flush

Installation

pip install print9

Quick start

from print9 import print9

# Use both wrap and color
print9("Hello, world! This line will be wrapped and colored.", wrap=40, color="green")

New Parameters

  • wrap: Optional[int]
    • Max line width to wrap each object's text.
    • If None or <= 0, wrapping is disabled.
    • Example: wrap=40 wraps long lines at 40 characters.
  • color: Optional[str]
    • Color for each object's text.
    • Accepts predefined names or a custom ANSI escape code.
    • If None, no color is applied.

Predefined color names

black, red, green, yellow, blue, magenta, cyan, white, orange, purple, pink, brown, gray.

Examples

from print9 import print9

# Wrap long text
long_text = """
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
""".strip()

print9(long_text, wrap=50)

# Use a predefined color
print9("Success!", color="green")

# Use a custom ANSI color (e.g., bright blue)
print9("Custom color", color="\x1b[94m")

# Combine multiple objects and forward kwargs to print()
print9("A", "B", "C", wrap=None, color=None, sep=" | ", end="\n\n")

Notes

  • Wrapping applies per object after converting it to a string.
  • Coloring wraps each object's text with the chosen color and a reset code.
  • All other keyword arguments are passed directly to Python's built-in print().

License

MIT License 2025 Vincent de Neuf. See LICENSE for details.

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

print9-0.1.2.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

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

print9-0.1.2-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file print9-0.1.2.tar.gz.

File metadata

  • Download URL: print9-0.1.2.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for print9-0.1.2.tar.gz
Algorithm Hash digest
SHA256 5d169b2e633b8f4641ff5e0713c3c121add7aed578a65b7bf39f43c1e7274584
MD5 c979267610c0458b87676cc343004a93
BLAKE2b-256 23cc876764588bdacb08b9e10e124dabb9d00b46fef8502f0a8b0bba5e449dfd

See more details on using hashes here.

File details

Details for the file print9-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: print9-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for print9-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6b92820a14d66e7f76879d254878d515b333ad6b048884b1122170ab935f8cdf
MD5 b2f9510aa90f4f711927dc8d85ccf4c8
BLAKE2b-256 e68bf09dd1432cbdd496064054a7dadb9334c270b2fd54de00bc8f3ca7fa3e51

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