title: Python HTML and re.sub
body: <p>I have a code like this:</p>
  
  <pre><code>(some code)
  x = read()
  
  html = ''' 
  &lt;html&gt;
  &lt;body&gt;
  
  &lt;div id="wrap"&gt;
      &lt;% name %&gt;
      &lt;p&gt;Time:&lt;/p&gt;
      &lt;table&gt;  
          &lt;% hours %&gt;
      &lt;/table&gt;
  &lt;/div&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
              '''
  result = re.sub(r'&lt;% hours %&gt;', x, html)
  f = open(name+'.html','w')
  f.write(result)
  f.close()
  </code></pre>
  
  <p>And now it prints correctly 'hours' in to HTML, but I would like to also set this &lt;% name %> as some variable but when I add another re.sub it's not working as it should.</p>
  
  <p>Is there a way to put two different parameters to html in code like above?</p>
  
  <p>Edit:</p>
  
  <p>Zroq solutions work for me, thanks!</p>