This Niffler finds shiny variables in text
Project description
Tiffler
A Niffler that only likes shiny variables
Installation
pip install -U tiffler
Usage
import tiffler
template = "One {unit} was equal to {num_sickles:int} Sickles or {num_knuts:int} Knuts."
variables = tiffler.scan(
template,
"one Galleon was equal to 17 Sickles or 493 Knuts.",
case_sensitive=False
)
print(variables)
#{'unit': 'Galleon', 'num_sickles': 17, 'num_knuts': 493}
import tiffler
template = "\s+{item}: {price:int} {unit:str:\w+}"
bill = """
Pewter cauldron: 15 galeons,
Brass cauldron: 21 galeons,
Copper cauldron: 25 galeons,
"""
for match in tiffler.search(template, bill, case_sensitive=False):
print(match)
# {'item': 'Pewter cauldron', 'price': 15, 'unit': 'galeons'}
# {'item': 'Brass cauldron', 'price': 21, 'unit': 'galeons'}
# {'item': 'Copper cauldron', 'price': 25, 'unit': 'galeons'}
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
tiffler-0.1.11.tar.gz
(3.0 kB
view details)
Built Distribution
File details
Details for the file tiffler-0.1.11.tar.gz
.
File metadata
- Download URL: tiffler-0.1.11.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c2ebf1ed37e606d952ffb4f4e9ab8593f4d30c9b4777030c576accceb97bb19e |
|
MD5 | ba5e9340f0db49d719ef79a6bcbd159b |
|
BLAKE2b-256 | 35ea6df82fcf9c9fce9f4437194d70669590022bb5ad7f29178fbac00894f26e |
File details
Details for the file tiffler-0.1.11-py3-none-any.whl
.
File metadata
- Download URL: tiffler-0.1.11-py3-none-any.whl
- Upload date:
- Size: 3.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 68586d476cea9006d2283a4baeafbaf169326bb1d8feb9891ff93ed32615ebf9 |
|
MD5 | f0fe8b876d0a24501f315dd75d528e33 |
|
BLAKE2b-256 | 0cfd706f7dbe119b987222a63c6c162ab65b01c2f6ebd95ce88908b791f01be5 |