2

I have a project that needs to automatically generate a python class according to some configuration files using python.

During my searches, I became familiar with Jinja2 which seems to be very popular for generating web pages, but I couldn't really find a similar case which uses Jinja to generate some python codes using Jinja (I know that it is definitely possible to do it, just the lack of examples made me hesitated).

Is it make sense to use Jinja2 for my case or is there any easier solution for generating python from python?!

Alireza
  • 800
  • 1
  • 7
  • 21

1 Answers1

2

You can use jinja to generate any text. I use jinja myself to generate python and there is at least one previous stack overflow post.

Jacques Kvam
  • 2,856
  • 1
  • 26
  • 31