Re: template strings for matching?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • skip@pobox.com

    Re: template strings for matching?


    Tino??? can you elaborate? I don't see the problem.

    Tino"%(foo)s" % mapping

    Joe wants to go in the other direction. Using your example, he wants a
    function which takes a string and a template string and returns a dict.
    Here's a concrete example:

    s = "My dog has fleas"
    fmt = "My $pet has $parasites"
    d = fmt_extract(fmt , s)
    assert d['pet'] == 'dog'
    assert d['parasites'] == 'fleas'

    Skip
Working...