- python:any (<< 2.8)
- python:any (>= 2.7.5-5~)
Parse strings using a specification based on the Python format() syntax.
.
``parse()`` is the opposite of ``format()``
.
The module is set up to only export ``parse()``, ``search()`` and
``findall()`` when ``import *`` is used:
.
>>> from parse import *
.
From there it's a simple thing to parse a string:
.
>>> parse("It's {}, I love it!", "It's spam, I love it!")
>>> _[0]
'spam'
.
Or to search a string for some pattern:
.
>>> search('Age: {:d}\n', 'Name: Rufus\nAge: 42\nColor: red\n')
.
This is the Python 2 package
Installed Size: 70.7 kB
Architectures: all