Split a string in parts and convert this in a datetime
<p>I scrapped a html string with the following content.</p>

<blockquote>
  <p>[u'Mitglied seit M\xe4rz 2016']</p>
</blockquote>

<p>M\xe4rz should be MÃ¤rz (German word for March).</p>

<p>I want to convert this scrapped output in a datetime.
My first try was to convert the output in a string and split this with the following code.</p>

<pre><code>strDate = string.split(str(scrapped))
</code></pre>

<p>My new output is now:</p>

<blockquote>
  <p>["[u'Mitglied", 'seit', 'M\xe4rz', "2016']"]</p>
</blockquote>

<p>The next step will be to add the first day of the month in the string.</p>

<pre><code>&gt; strDate = "1. " + strDate[2] + " " + strDate[3]
</code></pre>

<p>New Output is:</p>

<blockquote>
  <p>"1. M\xe4rz 2016']"</p>
</blockquote>

<p>How can I delete the \xe4 in a Ã¤ and delete the ']. 
And finally how can I convert this string "1. MÃ¤rz 2016" in a datetime with Python.</p>

<p>Thanks for your answers.</p>

<p>There is a way to encode the \xe4 character.</p>

<pre><code>str = 'Mitglied seit M\xe4rz 2016'
str = str.decode('unicode-escape').encode('utf-8')
str = '1. ' + str.split(' ')[2] + ' ' + str.split(' ')[3]
</code></pre>

python datetime scrapy type-conversion