Skip to main content

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

Project description

https://travis-ci.org/moreati/formatist.svg?branch=master

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.

Source Distribution

formatist-0.0.2.tar.gz (2.1 kB view details)

Uploaded Source

Built Distribution

formatist-0.0.2-py2.py3-none-any.whl (6.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file formatist-0.0.2.tar.gz.

File metadata

  • Download URL: formatist-0.0.2.tar.gz
  • Upload date:
  • Size: 2.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for formatist-0.0.2.tar.gz
Algorithm Hash digest
SHA256 90200ee343672ba7cc57ccf102733a50b11f48672551f29f93bdcbb58aa225b3
MD5 e0640a3e41651e61974802f290d30db8
BLAKE2b-256 01a2fc652fc86bbb2c8fea05171b3b07fad0c80a883b20577cf40d9b91c6e634

See more details on using hashes here.

File details

Details for the file formatist-0.0.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for formatist-0.0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 39fe9226e6ef6337916a149c9755df1bb1b5f4751452f9a95cf8cfd2ca7369d0
MD5 28361fbd62e1b722473683f84bfdd1d5
BLAKE2b-256 f8e3cb5fa8374e895f1e9fb15ae3f69b53c9fb7a9b406e601ba00d43ef92a81e

See more details on using hashes here.

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