Skip to main content

Format a list of strings into a single compact string

Project description

Return a list of strings as a compact set of columns arranged
horizontally or vertically.

For example, for a line width of 4 characters (arranged vertically):
['1', '2,', '3', '4'] => '1 3\n2 4\n'

or arranged horizontally:
['1', '2,', '3', '4'] => '1 2\n3 4\n'

Each column is only as wide as necessary. By default, columns are
separated by two spaces - one was not legible enough. Set "colsep"
to adjust the string separate columns. Set `displaywidth' to set
the line width.

Normally, consecutive items go down from the top to bottom from
the left-most column to the right-most. If +arrange_vertical+ is
set false, consecutive items will go across, left to right, top to
bottom.

Adapted from the routine of the same name inside cmd.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

columnize-0.3.1.zip (10.0 kB view hashes)

Uploaded Source

columnize-0.3.1.tar.gz (5.8 kB view hashes)

Uploaded Source

Built Distributions

columnize-0.3.1-py2.6.egg (6.1 kB view hashes)

Uploaded Source

columnize-0.3.1-py2.5.egg (6.1 kB view hashes)

Uploaded Source

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