title: Changing a date format using regex in Python
body: <p>I'm trying to convert a date that is in the format of <code>YYYYMMDD</code> to <code>MM/DD/YYYY</code> as it is being read from a database and written to an Excel file. Using Perl I would do the following:</p>
  
  <pre><code>var=~s/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])/$5$6\/$7$8\/$1$2$3$4/;
  </code></pre>
  
  <p>Keeping in mind that this is all happening in a "for row in rows" loop structure that is reading in the database info.</p>
  
  <p>Any help would be very much appreciated.</p>