title: How can I use a Jinja2 template inside a Python program?
body: <p>I have one python script which I want to execute as a daily cron job to send emails to all users. Currently I have hard-coded the html inside the script and it looks dirty. I have read <a href="http://jinja.pocoo.org/docs/" rel="noreferrer">the docs</a>, but I haven't figured out how can I render the template within my script.</p>
  
  <p>Is there any way that I can have the separate html file with placeholders which I can use python to populate and then send as the email's body?</p>
  
  <p>I want something like this:</p>
  
  <pre><code>mydict = {}
  template = '/templates/email.j2'
  fillTemplate(mydict)
  html = getHtml(filledTemplate)
  </code></pre>