In showing a long lists, sometimes one would prefer to see the value arranged aligned in columns. Some examples include listing methods of an object, listing debugger commands, or showing a numeric array with data aligned.
This is a Python module to format a simple (i.e. not nested) list into aligned columns. A string with embedded newline characters is returned.
Setup
$ python >>> import columnize
With String data
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.
>>> g = ('bibrons', 'golden', 'madascar', 'leopard', 'mourning', 'suras', 'tokay') >>> print(columnize.columnize(g, displaywidth=15)) bibrons suras golden tokay madascar leopard mourning>>> print(columnize.columnize(g, displaywidth=19, colsep=' | ')) bibrons | mourning golden | suras madascar | tokay leopard>>> print(columnize.columnize(g, displaywidth=18, colsep=' | ', ljust=False)) bibrons | suras golden | tokay madascar leopard
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.
With numeric data
>>> print(columnize.columnize(['1', '2', '3', '4'], displaywidth=6)) # => '1 3\n2 4\n' 1 3 2 4>>> print(columnize.columnize(list(range(1,6)), displaywidth=8)) 1 3 5 2 4
By default entries are left justified:
>>> print(columnize.columnize(list(range(1,16)), displaywidth=10))1 6 11 2 7 12 3 8 13 4 9 14 5 10 15
but you can change that with ljust or if arrange_array is set to True:
>>> print(columnize.columnize(list(range(1,16)), displaywidth=10, ljust=False)) 1 6 11 2 7 12 3 8 13 4 9 14 5 10 15>>> print(columnize.columnize(list(range(1,5)), opts={'arrange_array':True, 'displaywidth':6})) [1, 2 3, 4]
Credits
This module (essentially one function) was adapted from a private method of the same name from Python’s cmd module. Some adjustments and generalizations have been made.
pycolumnize for enterprise
Available as part of the Tidelift Subscription.
The maintainers of pycolumnize and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more.
Security contact information
To report a security vulnerability, please use the Tidelift security contact and Tidelift will coordinate the fix and disclosure.
Other stuff
Authors: Rocky Bernstein rb@dustyfeet.com
License: MIT
Metadata
Release files for columnize 0.3.11
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| columnize-0.3.11.tar.gz | 18.8 kB | Without provenance | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| columnize-0.3.11-py36-none-any.whl | Python 3.6 | none | any | Details |
| columnize-0.3.11-py3.10.egg | Legacy Egg format | - | - | Details |
| columnize-0.3.11-py3.9.egg | Legacy Egg format | - | - | Details |
| columnize-0.3.11-py3.8.egg | Legacy Egg format | - | - | Details |
| columnize-0.3.11-py3.7.egg | Legacy Egg format | - | - | Details |
| columnize-0.3.11-py3.6.egg | Legacy Egg format | - | - | Details |
| columnize-0.3.11-py3.5.egg | Legacy Egg format | - | - | Details |
| columnize-0.3.11-py3.4.egg | Legacy Egg format | - | - | Details |
| columnize-0.3.11-py3.3.egg | Legacy Egg format | - | - | Details |
| columnize-0.3.11-py3.2.egg | Legacy Egg format | - | - | Details |
| columnize-0.3.11-py3-none-any.whl | Python 3 | none | any | Details |
| columnize-0.3.11-py2.7.egg | Legacy Egg format | - | - | Details |
| columnize-0.3.11-py2.6.egg | Legacy Egg format | - | - | Details |
| columnize-0.3.11-py2.5.egg | Legacy Egg format | - | - | Details |
| columnize-0.3.11-py2.4.egg | Legacy Egg format | - | - | Details |
| columnize-0.3.11-py2-none-any.whl | Python 2 | none | any | Details |
Total release size: 184.7 kB
Release files / columnize-0.3.11.tar.gz
| Download URL | columnize-0.3.11.tar.gz |
|---|---|
| Size | 18.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a631b863b310a6c1457629b7bf32a3777ea5a407f8985311ce8c24c31d1d8bb2
|
|
BLAKE2b-256 checksum How to use checksums |
b0ab47c68ccca6052e18ccce562e6af92404b08cb2715edd9e9da31f4118cbcd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.6.14
|
Release files / columnize-0.3.11-py36-none-any.whl
| Download URL | columnize-0.3.11-py36-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 3.6 |
|
SHA-256 checksum How to use checksums |
10dc33cbe4ef96b777b407a96078cea2b195acfaf86592357e318180c81a83d9
|
|
BLAKE2b-256 checksum How to use checksums |
ddc39902c94a4835f64d7151c6c5c40687de1438f37118d9270d15b5a2212ab1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.6.14
|
Release files / columnize-0.3.11-py3.10.egg
| Download URL | columnize-0.3.11-py3.10.egg |
|---|---|
| Size | 10.9 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
f5e68fea1f15a546dcaea846a167f48a590954788bb556571ada89f9d7b8ddcc
|
|
BLAKE2b-256 checksum How to use checksums |
79dfd7687e75f31cc025e0ee3e1b382461bb7fbd8e2f9472f50a35c284fa648b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.6.14
|
Release files / columnize-0.3.11-py3.9.egg
| Download URL | columnize-0.3.11-py3.9.egg |
|---|---|
| Size | 10.9 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
30f0a7d750487b4de0da1c5ca39d6aab0d9493628d24b19febee2a024a5b646f
|
|
BLAKE2b-256 checksum How to use checksums |
b0fa2ce8090659b4fa1f0b015c2ef818d77473d6e93c6539670fd6cf867781b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.6.14
|
Release files / columnize-0.3.11-py3.8.egg
| Download URL | columnize-0.3.11-py3.8.egg |
|---|---|
| Size | 10.9 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
46a9fdb5d9625868728ecd3d075cc208732372e2f0784daf8f9bf3e3e3b7c88f
|
|
BLAKE2b-256 checksum How to use checksums |
015d5b87d52b9f4daf05b3bee84c7a8eb83359221985ea18a637bb01e78d9013
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.6.14
|
Release files / columnize-0.3.11-py3.7.egg
| Download URL | columnize-0.3.11-py3.7.egg |
|---|---|
| Size | 10.9 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
938d0b4f4c43ef78343906242d194ae2e7bb75952e4f976e30cf63ba2221a8f7
|
|
BLAKE2b-256 checksum How to use checksums |
ec219caac93fe566e163b89493693cd7356f1a9402aca4ce384411462533d066
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.6.14
|
Release files / columnize-0.3.11-py3.6.egg
| Download URL | columnize-0.3.11-py3.6.egg |
|---|---|
| Size | 11.0 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
a03e1a21c9b3b069a2243d93893640555f0f8e7d3d456af3660ab553d7adbebd
|
|
BLAKE2b-256 checksum How to use checksums |
65e600e30b560cfc87a4376de4fb31336d7ab7360e4c0d644ea911a04466f544
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.6.14
|
Release files / columnize-0.3.11-py3.5.egg
| Download URL | columnize-0.3.11-py3.5.egg |
|---|---|
| Size | 11.1 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
844a01077be698e7232253dc9b4c8971d93275000d7f4af17218dfaeb9bd557b
|
|
BLAKE2b-256 checksum How to use checksums |
9fcbd96afda26d147007aa1a176217205bf622d11412225a732d1592102b379a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.6.14
|
Release files / columnize-0.3.11-py3.4.egg
| Download URL | columnize-0.3.11-py3.4.egg |
|---|---|
| Size | 11.1 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
477c472c4beec17aa20a705def9b243b1846584907eb8671330c258e4a22e0e9
|
|
BLAKE2b-256 checksum How to use checksums |
7fbcd1dff951159ef3e0cc831dfff54a0e2dff36d480f081237367736f9a088c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.6.14
|
Release files / columnize-0.3.11-py3.3.egg
| Download URL | columnize-0.3.11-py3.3.egg |
|---|---|
| Size | 11.1 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
d40e31904ba0d8c024f48dc85a0aaa4f9ef19cb72238c44d93ba23873f379bd4
|
|
BLAKE2b-256 checksum How to use checksums |
211925987111865f6ffcfe200df2c26cc8bf2efa8a6ef5ac64f75c419cd02789
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.6.14
|
Release files / columnize-0.3.11-py3.2.egg
| Download URL | columnize-0.3.11-py3.2.egg |
|---|---|
| Size | 11.1 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
b723c3791672b69c859e4e32a6fd2a1958a05d94874a2d2fb46c87bc8df4e817
|
|
BLAKE2b-256 checksum How to use checksums |
ed6a1ce9762634a7db08a1171ae2e2c9e63dab7ad07b997bdcdeb1723233d860
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.6.14
|
Release files / columnize-0.3.11-py3-none-any.whl
| Download URL | columnize-0.3.11-py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3c474ca632e474df8f012843fb74a4c0bea4e8876d49a17f952f8e82f14cbc3d
|
|
BLAKE2b-256 checksum How to use checksums |
dedac1f84838ecb3e84c3c85c691f51f1e2dfcf7be745761d9f6462c909175ad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.6.14
|
Release files / columnize-0.3.11-py2.7.egg
| Download URL | columnize-0.3.11-py2.7.egg |
|---|---|
| Size | 10.9 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
0fe17409dbb30a3534806a69ed0540467b31276689e10383b3c989b66014666e
|
|
BLAKE2b-256 checksum How to use checksums |
d66f4e875ac31ba2156466277ca44247d2295061d2b1cdc99d67892ea03f379a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.6.14
|
Release files / columnize-0.3.11-py2.6.egg
| Download URL | columnize-0.3.11-py2.6.egg |
|---|---|
| Size | 10.9 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
23db4ca4ed6a27c3a0b12407d1590729876a8983b625adcf3e1b6bf18b54e8d5
|
|
BLAKE2b-256 checksum How to use checksums |
01e76630dac1d79a53aa5f165e9bb2586bc2f0fbdb97480318515f94544dcf30
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.6.14
|
Release files / columnize-0.3.11-py2.5.egg
| Download URL | columnize-0.3.11-py2.5.egg |
|---|---|
| Size | 10.9 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
92bbac9ec7bca0f97eb011a3b15a9703dd02a28bbcc4fda7d9d99078af68325e
|
|
BLAKE2b-256 checksum How to use checksums |
af7eb6a5ba02861ebb9cc29e3d5550ab290e0cb9ebceb5b99d83cfe158b3d184
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.6.14
|
Release files / columnize-0.3.11-py2.4.egg
| Download URL | columnize-0.3.11-py2.4.egg |
|---|---|
| Size | 11.0 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
1d16a58a7fce2ec7b716e7516736cf8351bcd66583482aa542ea025244b73ae6
|
|
BLAKE2b-256 checksum How to use checksums |
65462380ea8b3c99a61bc9d80f0e341d52a1ae32c0b7464bf152ddffc266ef40
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.6.14
|
Release files / columnize-0.3.11-py2-none-any.whl
| Download URL | columnize-0.3.11-py2-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
e4f5f53eadaddfa7bd57150d6f0ed8c7e704b82b196b17290f97fc1f5422bb54
|
|
BLAKE2b-256 checksum How to use checksums |
8a3fd47e953bcc8ff5b8b5f6ddcf71b2fc5d9083c54fa8ccbe76883cf8a2bf4c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.6.14
|
Security for columnize 0.3.11
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.