title: How can I create a web page with a countdown timer in Python3?
body: <p>I need to create a web page with a countdown timer.  The below doesn't work, because the web page halts until after the countdown completes.  It doesn't update the page every second, and it also does not place the values in the  properly.  It scrolls them.  How can I get this to work?  Alternately, I believe I could embed javascript into the Python code, but I have not firgured out how to do this.  Everything I have fund in the web concerning calling a javascript from Python seems very arcane, and I can't figure it out, at all.</p>
  
  <p>index.html:</p>
  
  <pre><code>div.Countdown {
      position: fixed;
      top: 26;
      left: 480;
      width: 300px;
      font: bold 24px Arial;
      color: black;
  }
  &lt;/STYLE&gt;
  </code></pre>
  
  <p>index.cgi:</p>
  
  <pre><code>import time
  
  print( '&lt;/b&gt;&lt;/h2&gt;&lt;/table&gt;&lt;/p&gt;')
  def countdown(t):
      while t:
          mins, secs = divmod(t, 60)
          timeformat = '{:02d}:{:02d}'.format(mins, secs)
          print( '&lt;div id="Countdown"&gt;')
          print(timeformat, flush=True)
          print('&lt;/div&gt;')
          time.sleep(1)
          t -= 1
      print('Goodbye!\n\n\n\n\n')
  
  
  countdown(4)
  
  print( '&lt;/BODY&gt;')
  print( '&lt;/HTML&gt;')```
  </code></pre>