Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is It possible to create Python files using Jinja

Tags:

python

jinja2

As far as I have read it seems like Jinja is only for creating HTML files. Can it be used for creating python files as well?

like image 252
ronbansal Avatar asked Sep 11 '25 10:09

ronbansal


1 Answers

Yes. It is not specific to HTML, you can generate any type of file.

For more information, see http://jinja.pocoo.org/docs/2.10/templates/

A Jinja template is simply a text file. Jinja can generate any text-based format (HTML, XML, CSV, LaTeX, etc.). A Jinja template doesn’t need to have a specific extension: .html, .xml, or any other extension is just fine.

like image 58
Oliver Ni Avatar answered Sep 14 '25 00:09

Oliver Ni