columnizer
This is a simple package for which creates columnized text tables. This is particularly useful where the text is of N length. You can use the following example, to show a good set of uses. I find this code particularly useful in command line tools.
from columnizer import *
def test_columns(columnizer):
test_text = "the quick brown fox jumped over the lazy dogs!"
column_count = len(columnizer.columns)
test_rows = []
if columnizer.first_row_headers:
header_titles=["A","B","C","D","E","F","G","H"]
test_rows.append(header_titles[:column_count])
test_rows.append([test_text for _ in range(0,column_count)])
result = columnizer.apply(test_rows)
print (result)
c = Columnizer(
columns=[ColumnClipped(width=25), ColumnLineWrap(width=17), ColumnWordWrap(width=17),
ColumnWordWrap(alignment=ColumnTextAlignment.RIGHT, width=17),
ColumnWordWrap(alignment=ColumnTextAlignment.CENTER, width=17)],
style = ColumnTableStyleHeavy())
print ("Heavy:")
test_columns(c)
c = Columnizer(
columns=[ColumnClipped(width=25), ColumnLineWrap(width=17), ColumnWordWrap(width=17),
ColumnWordWrap(alignment=ColumnTextAlignment.RIGHT, width=17),
ColumnWordWrap(alignment=ColumnTextAlignment.CENTER, width=17)])
print ("Default:")
test_columns(c)
print ("Default + Headers:")
c.first_row_headers = True
test_columns(c)
Columns are actual classes, and are used to describe the physical size and style of the columns. Rows are lists of lists, with each container list being used to store data for each column in the row.
Metadata
Release files for columnizer 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| columnizer-0.0.1.tar.gz | 4.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| columnizer-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.0 kB
Release files / columnizer-0.0.1.tar.gz
| Download URL | columnizer-0.0.1.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9dd05b0d3e2d27504638e925b3b2084375b4019d4977b71fc21f169676cee9b2
|
|
BLAKE2b-256 checksum How to use checksums |
79bee3c1f848014abf745262f06f00ecd271d99934402264282ca06c43977c9b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.4
|
Release files / columnizer-0.0.1-py3-none-any.whl
| Download URL | columnizer-0.0.1-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d5775f6830c8d9d9bf916c8a787da0463a23a0ba1c3e411315780576a1ffcc03
|
|
BLAKE2b-256 checksum How to use checksums |
88626e041467054e2fb44cf4316f6b980b9372fe91e33c9b843a64ae86fb8635
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.4
|