title: How to open/import new html files with Python cgi?
body: <p>I want to show/display test.html (which is located in the same directory as the script) if the input of the user is correct.</p>
  
  <p><strong>Test.html:</strong></p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;&lt;title&gt;Test&lt;/title&gt;&lt;/head&gt;
  &lt;body&gt;
    &lt;p&gt;Test&lt;/p&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>Form.html:</strong></p>
  
  <pre><code>&lt;form action="submit.cgi" method="get"&gt;
  &lt;p&gt;Question 1&lt;/p&gt;   
  &lt;select name="form1"&gt;
  &lt;option value="1"&gt;Test 1&lt;/option&gt;
  &lt;option value="2"&gt;Test 2&lt;/option&gt;
  &lt;/select&gt;
  
  &lt;p&gt;Question 2&lt;/p&gt;
  &lt;select name="form2"&gt;
  &lt;option value="3"&gt;Test 3&lt;/option&gt;
  &lt;option value="4"&gt;Test 4&lt;/option&gt;
  &lt;/select&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>Python script (submit.cgi):</strong></p>
  
  <pre><code>#!/usr/bin/python3
  
  import cgi
  import cgitb
  
  print ('Content-type: text/html\n\n')
  form = cgi.FieldStorage() 
  if form["form1"].value == '1' and form["form2"].value == '3':
      ...?
  </code></pre>
  
  <p>I know it's possible to just print the whole test.html in the script (that worked), but i'd prefer to import/open html pages (especially with multiple or large html files). I tried:</p>
  
  <pre><code>open("test.html") 
  </code></pre>
  
  <p>But that didn't work. Does somebody know how it can be done? </p>