Python tools for splitting strings.
Exacto is a collection of Python tools that simplify splitting strings according to non-trivial business rules. You may find this package useful if:
- A regular expression is not enough for your use case.
- You want to avoid writing and maintaining manual parsing code.
- You don't want to mess around with LLVM or FSMs.
However, if performance is your primary goal, these tools may not be for you.
from exacto import split, lift, quote, nest # Simple example with default rules: split on whitespace result = split("Hello World") assert list(result) == ["Hello", "World"] # Complicated example with custom separator and quotes result = split("ENV='Prod-18.104.22.168'.VER='2.1'", quote("'"), ".") assert list(result) == ["ENV='Prod Env'", "VER='2.1'"] # Extract embedded tokens result = lift("Hello [FOO] is [BAR]", nest("[", "]")) assert list(result) == ["FOO", "BAR"]
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size exacto-0.2.2.tar.gz (4.1 kB)||File type Source||Python version None||Upload date||Hashes View hashes|