title: How to redirect a page to another page in Python 3 cgi
body: <p>I am studying Python recently and a beginner. I am unable set a logic to as, if the post data does not qualify, post page will be redirected to origin page.</p>
  
  <p>After some research I found this <a href="https://stackoverflow.com/questions/10768522/python-send-post-with-header">how to redirect one page to another</a>, but still having confusion regarding redirecting page.</p>
  
  <p>Here is my html code :</p>
  
  <p><code>&lt;form action="generate_timing_data.py" method="POST"&gt;
  &lt;p&gt;Select an athlete from the list to work with:
  &lt;/p&gt;&lt;input type="radio" name="which_athlete" value="Mikey McManus"&gt; Mikey McManus&lt;br /&gt;
  &lt;input type="radio" name="which_athlete" value="Julie Jones"&gt; Julie Jones&lt;br /&gt;
  &lt;input type="radio" name="which_athlete" value="James Lee"&gt; James Lee&lt;br /&gt;&lt;input type="radio" name="which_athlete" value="Sarah Sweeney"&gt; Sarah Sweeney&lt;br /&gt;&lt;p&gt;
  &lt;/p&gt;&lt;input type=submit value="Select"&gt;
  &lt;/form&gt;</code>
  And this is my python code :</p>
  
  <pre><code>import cgi
  import athletemodel
  import yate
  form_data = cgi.FieldStorage()
  if form_data['which_athlete'].value != '':
     //calculation stuff
  else :
     //redirect stuff
  </code></pre>
  
  <p>In here, where to put header code and all the staff in form and how to redirect to origin page from the post page, how to set all the things? please help me to understand how the process flow?</p>