Skip to main content

Terminal print strings in columns

Project description

column_print.py

A simple way to print short strings to a terminal in columns.

Unlike many similar utilities, it is NOT necessary for the strings to be in a list before printing. column_print can print any sequence of strings without knowing the length or number of strings in advance.

ColumnPrinter

A context manager class to print successive print statements in columns.

Example Usage:

from modules.column_print import ColumnPrinter
with ColumnPrinter(2, 80) as cp:
    cp("Hello")
    cp("World")

Prints:

Hello                                   World
Goodbye                                 Moon

print_list

A function to print a list of items in columns.

Example usage:

from modules.column_print import ColumnPrinter
with ColumnPrinter(2, 80) as cp:
    cp.print_list(mylist)

Supported Platforms:

  • Linux (Windows and macOS to be added)
  • Python 3.6 or Later

Developing column_printer

To install column_printer, along with the tools you need to develop, test, and document, run the following in your virtualenv:

$ pip install -e .[dev]

or, using pipenv:

$ pipenv install -e .

See also TODO.txt

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

column_print-0.1.0.tar.gz (19.3 kB view hashes)

Uploaded Source

Built Distribution

column_print-0.1.0-py3-none-any.whl (18.6 kB view hashes)

Uploaded Python 3

Supported by

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