Popular recipes by Joel Gould http://code.activestate.com/recipes/users/98066/popular/2001-03-09T05:30:56-08:00ActiveState Code RecipesReplace embedded Python code in a string with the results of executing that code (Python)
2001-03-09T05:30:56-08:00Joel Gouldhttp://code.activestate.com/recipes/users/98066/http://code.activestate.com/recipes/52217-replace-embedded-python-code-in-a-string-with-the-/
<p style="color: grey">
Python
recipe 52217
by <a href="/recipes/users/98066/">Joel Gould</a>
.
</p>
<p>This code was originally designed for dynamically creating HTML. It takes a template, which is a string that may included embedded Python code, and returns another string where any embedded Python is replaced with the results of executing that code.</p>