title: How to write and save html file in python?
body: <p>This is what I know about writing to an HTML file and saving it:</p>
  <pre><code>html_file = open(&quot;filename&quot;,&quot;w&quot;)
  html_file.write()
  html_file.close()
  </code></pre>
  <p>But how do I save to the file if I want to write a really long codes like this:</p>
  <pre><code>   1   &lt;table border=1&gt;
     2     &lt;tr&gt;
     3       &lt;th&gt;Number&lt;/th&gt;
     4       &lt;th&gt;Square&lt;/th&gt;
     5     &lt;/tr&gt;
     6     &lt;indent&gt;
     7     &lt;% for i in range(10): %&gt;
     8       &lt;tr&gt;
     9       &lt;td&gt;&lt;%= i %&gt;&lt;/td&gt;
     10      &lt;td&gt;&lt;%= i**2 %&gt;&lt;/td&gt;
     11      &lt;/tr&gt;
     12    &lt;/indent&gt;
     13  &lt;/table&gt;
  </code></pre>