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, defaultformatter
>>> 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.0.tar.gz
(3.8 kB
view hashes)
Built Distribution
Close
Hashes for pyformatting-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b52c2a938853dd9771fb36f6a3b1ab49a0a9803d4343920fce7dde9f98fe210 |
|
MD5 | b1cd3c3e1926654a42da4a2a39db87f5 |
|
BLAKE2b-256 | b73302ae04cad9ceae2da3ceef1b07660039c8bec05d6d5b0dcf46d01d006887 |