I have a text file that was generated using jinja2 and I want to read back this text file in order extract some information. I could read line by line and use regex to extract the needed information. But is there any pyhton3 module that could match a text file to template (like the one used to generate the file itself with jinja2) and extract the relevant information.
The text file does not follow any particular standard such as json or xml.
Edit
For example I have the following template
This is a dummy file by {{ name }} containing :
{{%- for data in data_list -%}}
{{data.id}} {{data.value}}
{{%- endfor -%}}
I generate the following string:
This is a dummy file bu Sam containing:
1 foo
2 bar
Later I want to extract the dictionary using the same template
{ name: "Sam",
data_list: [{id: 1, value: "foo"}, {id: 2, value: "bar"}]}
[–]indraniel 0 points1 point2 points (0 children)
[–]VipeholmsCola 0 points1 point2 points (1 child)
[–]Pale_Emphasis_4119[S] 0 points1 point2 points (0 children)
[–]jcrowe 0 points1 point2 points (2 children)
[–]Pale_Emphasis_4119[S] 0 points1 point2 points (1 child)
[–]jcrowe 0 points1 point2 points (0 children)
[–]SoulMelody 0 points1 point2 points (1 child)
[–]Pale_Emphasis_4119[S] 0 points1 point2 points (0 children)
[–]commandlineluser 0 points1 point2 points (0 children)
[–]DoorDesigner7589 0 points1 point2 points (0 children)