I know the flask function render_template
. I have to give the file name of the template. But now I want to render the string of a template (that is the content of the template). That makes sense. but I don't want to explain now why. How can I render the text of a template simply?
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
you can use from_string
Actually you can call jinja2 render function directly:
When not working with flask, this is useful
You can use
render_template_string
:Taken from What's the easiest way to escape HTML in Python.