https://github.com/moreati/formatist
Converts %-style format strings to newer {}-style
https://github.com/moreati/formatist
Last synced: 7 months ago
JSON representation
Converts %-style format strings to newer {}-style
- Host: GitHub
- URL: https://github.com/moreati/formatist
- Owner: moreati
- Created: 2015-10-08T10:16:39.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-10-09T23:37:00.000Z (almost 10 years ago)
- Last Synced: 2025-03-18T07:47:39.596Z (7 months ago)
- Language: Python
- Size: 125 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.rst
Awesome Lists containing this project
README
formatist
=========.. image:: https://travis-ci.org/moreati/formatist.svg?branch=master
:target: https://travis-ci.org/moreati/formatistA Python library to convert from older `%` style format strings, to newer
`{}` style... code:: python
>>> 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