Reverse pystache
I have this script:
import pystache template = 'Hi {{person}}!' data = {'person': 'Mom'} txt = pystache.render(template, data) print txt
What gives:
Hi Mom!
Is there a way to do something like:
data = reverse_pystache(txt, template)
To return a dictionary:
>>> data
{'person': 'Mom'}
That is, by reusing the template that was used to generate the text and the actual text, extract the data from the text.
+3
source to share
No one has answered this question yet
Check out similar questions: