Skip to main content

Just a printing listed version function.

Project description

listele

Prints the given iterable in a listed format with columns and spacing.

Installation

pip install listele

Usage

from listele import listele

listele(li, column, /, *, spaces=30, find="", regex="", vertical=False, out=stdout, err_out=stderr)
Parameter Description
li A list or dict to display. Dicts are formatted as "key: value".
column Number of columns in output.
spaces Minimum width of each column.
find Case-insensitive substring filter.
regex Regex pattern to filter elements (uses match).
vertical If True, fill columns top-to-bottom instead of left-to-right.
out Output stream for results.
err_out Stream for error and warning messages.

Examples

Basic usage:

listele(range(1, 13), 4)
1                             2                             3                             4
5                             6                             7                             8
9                             10                            11                            12

Filtering with find:

li = ['apple', 'apricot', 'banana', 'cherry', 'avocado', 'blueberry']
listele(li, 3, find="a")
apple                         apricot                       banana
avocado

Filtering with regex:

li = ['file1.txt', 'file2.txt', 'image1.png', 'image2.png', 'data.csv']
listele(li, 3, regex=".*\\.txt$")
file1.txt                     file2.txt

Vertical (top to bottom):

listele(range(1, 10), 3, vertical=True)
1                             4                             7
2                             5                             8
3                             6                             9

Dictionary:

d = {'name': 'Ali', 'age': 25, 'city': 'Istanbul', 'job': 'dev', 'lang': 'Python', 'tool': 'vim'}
listele(d, 2, spaces=25)
name: Ali                age: 25
city: Istanbul           job: dev
lang: Python             tool: vim

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

listele-2.1.0.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

listele-2.1.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file listele-2.1.0.tar.gz.

File metadata

  • Download URL: listele-2.1.0.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for listele-2.1.0.tar.gz
Algorithm Hash digest
SHA256 e9f19df6b9d92c51415938e31709afd3fb75af2ebdb46a5f878ee75025043e26
MD5 7383bf797f7f83d94d6783d5e59a58d0
BLAKE2b-256 a37f7369c2e36d14505daf5516d7e12c05583b7875f10a9c94e9c9e8ac84ce7f

See more details on using hashes here.

File details

Details for the file listele-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: listele-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for listele-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dd4bb1eb353d72e3e4d55776acada68d396067b9b30f3d4065c8d1d5594c24e0
MD5 6b820dfc4da92bf7013668be8082ffb1
BLAKE2b-256 f4b5145b787592a9f47f121a0e9068a8ac7d7cd34322074d91691f48258754cf

See more details on using hashes here.

Supported by

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