Skip to main content

Converts %-style format strings to newer {}-style

Project description

A Python library to convert from older % style format strings, to newer {} style.

>>> import formatist
>>> greeting = "Hello %(name)s. It's %(temp).1f C"
>>> print(greeting % {'name': 'Alice', 'temp': 23.45678})
Hello Alice. It's 23.5 C
>>> greeting2 = formatist.convert(greeting)
>>> print(greeting2)
Hello {name!s:}. It's {temp:>.1f} C
>>> print(greeting2.format(name='Alice', temp=23.45678))
Hello Alice. It's 23.5 C

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 formatist, version 0.0.2
Filename, size File type Python version Upload date Hashes
Filename, size formatist-0.0.2-py2.py3-none-any.whl (6.3 kB) File type Wheel Python version 2.7 Upload date Hashes View
Filename, size formatist-0.0.2.tar.gz (2.1 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