Reformat a date string with hyphens
<p>I'm relatively new to python and would like to write clean code from the beginning. I need a parser of a string which formats a date in the form of "20140101" into "2014-01-01". How I achieved this is via:</p>

<pre><code>def parse(date):

    list_date = list(date)
    list_date.insert(4,"-")
    list_date.insert(7,"-")
    return "".join(list_date)
</code></pre>

<p>which works perfectly fine but looks not very clean. Maybe there is no other solution but if there is a more pythonic way to code it would be appreciated if you would share this!</p>