Skip to main content

Format a simple (i.e. not nested) list into aligned columns.

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


0.3.6 04-22-13

- Fix bugs in arrange_array

0.3.5 04-18-13

- Reinstate ability to run on older Pythons. In particular Python
2.4.6 and 2.5.6 now. I suppose other version in between work too.

- Add opts hash to bundle the growing options old and new:
* arrange_array
* arrange_vertical
* arrange_horizontal
* array_prefix
* array_suffix
* colsep
* colfmt
* displaywidth
* lineprefix
* linesuffix
* ljust

- Fixes to make source tarball work. (Added test files properly)

0.3.4 01-03-13
- Make 3k tolerant. This means it no longer works for versions less
than Python 2.6.

0.3.3 10-28-10
- Work on packaging
- Remove pyflakes warnings
- Correct licensing information

0.3.2 03-08-09 - Ron Frankel -1 Release

- Relax restriction that array has to be string. Now is just something
we can call str() on each of the elements on.

- Correct bug in vertical alignment

- Add an optional initial line prefix string

0.3.1 01-10-09 - Sam Woodward Release
- Some small typos fixed.

0.3.0 01-05-09

- 0.2.0 had bad bugs - don't use.
Allow specifying right justification as well as left justification

0.2.0 12-31-08

- Add ability to run columns vertically

Project details


Release history Release notifications

History Node

0.3.9

History Node

0.3.8

History Node

0.3.7

This version
History Node

0.3.6

History Node

0.3.5-01

History Node

0.3.5

History Node

0.3.4

History Node

0.3.3

History Node

0.3.2

History Node

0.3.1

History Node

0.3.0

History Node

0.2.0

History Node

0.1.0

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
columnize-0.3.6-py2.4.egg (8.5 kB) Copy SHA256 hash SHA256 Egg 2.4 Apr 22, 2013
columnize-0.3.6-py2.5.egg (8.4 kB) Copy SHA256 hash SHA256 Egg 2.5 Apr 22, 2013
columnize-0.3.6-py2.6.egg (8.4 kB) Copy SHA256 hash SHA256 Egg 2.6 Apr 22, 2013
columnize-0.3.6-py2.7.egg (8.4 kB) Copy SHA256 hash SHA256 Egg 2.7 Apr 22, 2013
columnize-0.3.6-py3.2.egg (8.5 kB) Copy SHA256 hash SHA256 Egg 3.2 Apr 22, 2013
columnize-0.3.6-py3.3.egg (8.5 kB) Copy SHA256 hash SHA256 Egg 3.3 Apr 22, 2013
columnize-0.3.6.tar.gz (9.1 kB) Copy SHA256 hash SHA256 Source None Apr 22, 2013

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page