How do I parse a templated string in Python?
- by mLewisLogic
I'm new to Python, so I'm not sure exactly what this operation is called, hence I'm having a hard time searching for information in it.
Basically I'd like to have a string such as:
"[[size]] widget that [[verb]] [[noun]]"
Where size, verb, and noun are each a list.
I'd like to interpret the string as a metalanguage, such that I can make lots of sentences out permutations from the lists. As a metalanguage, I'd also be able to make other strings that use those pre-defined lists to generate more permutations.
Are there any capabilities for variable substitution like this in Python? What term describes this operation if I should just Google it?