Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pyformatting, version 0.2.1
Filename, size File type Python version Upload date Hashes
Filename, size pyformatting-0.2.1-py3-none-any.whl (5.3 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size pyformatting-0.2.1.tar.gz (3.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page