title: In python, how to decode strings whose literal content is in utf-8?
body: <p>I was trying to make an add-on for <a href="https://github.com/ankitects/anki" rel="nofollow noreferrer">Anki</a> which imports the opml notes from Mubu, and I the contents that I needed were stored in a <code>str</code> object like the one below, and I was not able to decode them or convert them into byte objects.</p>
  <pre><code>&quot;\x3Cspan\x3E\xE6\x88\x91\xE5\x8F\x91\xE7\x8E\xB0\xE6\x88\x91\xE5\xB1\x85\xE7\x84\xB6\xE6\xB2\xA1\xE6\x9C\x89\xE6\xB5\x8B\xE8\xAF\x95\xE8\xBF\x87\xE4\xB8\xAD\xE6\x96\x87\xEF\xBC\x8C\xE8\xBF\x99\xE4\xB8\xAA\xE5\xB0\xB1\xE5\xA4\xAA\xE7\xA6\xBB\xE8\xB0\xB1\xE4\xBA\x86\xE3\x80\x82\x3C/span\x3E&quot;
  </code></pre>
  <p>Previously, I was trying able to decode this string using the following method, but it does not support utf-8:</p>
  <pre class="lang-py prettyprint-override"><code>text = text.encode().decode(&quot;unicode_escape&quot;)
  </code></pre>
  <p>I wonder if there is a way to turn str objects whose literal content is in utf-8 into byte objects.</p>