title: Python template engine
body: <p>Could it be possible if somebody could help me get started in writing a python template engine? I'm new to python and as I learn the language I've managed to write a little MVC framework running in its own light-weight-WSGI-like server.</p>
  
  <p>I've managed to write a script that finds and replaces keys for values:
  (Obviously this is not how my script is structured or implemented. this is just an example)</p>
  
  <pre><code>from string import Template
  
  html  = '&lt;html&gt;\n'
  html += '  &lt;head&gt;\n'
  html += '  &lt;title&gt;This is so Cool : In Controller HTML&lt;/title&gt;\n'
  html += '  &lt;/head&gt;\n'
  html += '  &lt;body&gt;\n'
  html += '    Home | &lt;a href="/hi"&gt;Hi ${name}&lt;/a&gt;\n'
  html += '  &lt;/body&gt;\n'
  html += '&lt;html&gt;'
  
  Template(html).safe_substitute(dict(name = 'Arturo'))
  </code></pre>
  
  <p>My next goal is to implement custom statements, modifiers, functions, etc (like 'for' loop) but i don't really know if i should use another module that i don't know about. I thought of regular expressions but i kind feel like that wouldn't be an efficient way of doing it</p>
  
  <p>Any help is appreciated, and i'm sure this will be of use to other people too.</p>
  
  <p>Thank you</p>