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
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
formatist-0.0.2.tar.gz
(2.1 kB
view details)
Built Distribution
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90200ee343672ba7cc57ccf102733a50b11f48672551f29f93bdcbb58aa225b3 |
|
MD5 | e0640a3e41651e61974802f290d30db8 |
|
BLAKE2b-256 | 01a2fc652fc86bbb2c8fea05171b3b07fad0c80a883b20577cf40d9b91c6e634 |
File details
Details for the file formatist-0.0.2-py2.py3-none-any.whl
.
File metadata
- Download URL: formatist-0.0.2-py2.py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 39fe9226e6ef6337916a149c9755df1bb1b5f4751452f9a95cf8cfd2ca7369d0 |
|
MD5 | 28361fbd62e1b722473683f84bfdd1d5 |
|
BLAKE2b-256 | f8e3cb5fa8374e895f1e9fb15ae3f69b53c9fb7a9b406e601ba00d43ef92a81e |