Skip to main content

Format Iterables

Project description

list-fmt

Format iterables into human readable text.

Installation

pip install list-fmt

Basic Usage

>>> from listfmt import join_with
>>> L = ["one", "two", "three"]
>>> join_with(L, join_last = " and ")
'one, two and three'
>>> 
>>> from listfmt import strjoin
>>> strjoin(", ", [1, 2, 3])
'1, 2, 3'
>>> 
>>> from list import ordered_list
>>> print(ordered_list(["one", "two", "three"], style = "A"))
A. one
B. two
C. three
>>> 
>>> from listfmt import unordered_list
>>> print(unordered_list(["one", "two", ["a", "b"], "three"], recursive = True))
* one
* two
  * a
  * b
* three
>>> 

Links

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

list-fmt-0.0.1.tar.gz (3.6 kB view hashes)

Uploaded Source

Built Distribution

list_fmt-0.0.1-py3-none-any.whl (3.6 kB view hashes)

Uploaded Python 3

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