title: Reading utf-8 escape sequences from a file
body: <p>I have an utf-8 encoded file that contains multiple lines like</p>
  
  <pre>
  \x02I don't like \x0307bananas\x03.\x02
  Hey, how are you doing?
  You called?
  </pre>
  
  <p>How do I read the lines of that file to a list, decoding all the escape sequences?
  I tried the code below:</p>
  
  <pre><code>with codecs.open(file, 'r', encoding='utf-8') as q:
      quotes = q.readlines()
  
  print(str(random.choice(quotes)))
  </code></pre>
  
  <p>But it prints the line without decoding escape characters.</p>
  
  <pre>\x02I don't like \x0307bananas\x03\x02</pre>
  
  <p>(Note: escape characters are IRC color codes, <code>\x02</code> being character for bolded text, and <code>\x03</code> prefix for color codes. Also, this code is from within my IRC bot, with the MSG function replaced by <code>print()</code>)</p>