Pyformatting is a collection of useful formatting features.
Project description
pyformatting
Pyformatting is a collection of useful formatting features.
>>> from pyformatting import optional_format, defaultformatter
>>> optional_format('{number:.3f}{other}', number=.12345)
'0.123{other}'
>>> optional_format('{0.imag}{1}{2}{0.real}', 1+3j)
'3.0{1}{2}1.0'
>>> optional_format('{first}{string!r}{42}', string='cool')
"{first}'cool'{42}"
>>> default_format = defaultformatter(int)
>>> default_format('{zero}{data}{zero_again}', data={1: 2})
'0{1: 2}0'
python >= 3.4:
>>> from pyformatting import optional_format
>>> optional_format('{}{other}{some}', some=[1, 2])
'{}{other}[1, 2]'
Installing Pyformatting and Supported Versions
Pyformatting is available on PyPI:
python -m pip install -U pyformatting
Pyformatting supports Python 3.0+.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyformatting-0.2.1.tar.gz
(3.7 kB
view hashes)
Built Distribution
Close
Hashes for pyformatting-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3736b71af2bf78958715303f6a8eba5059c3e8cb99ae5a2f9c8da12b906e5eed |
|
MD5 | c38e102ff71f5dc68c19eafe53e1993d |
|
BLAKE2b-256 | 20999ccf91917c55c2c3a569fe1ce8458dd2d8a24379ddf144f1e49c259b8885 |