title: Python hex variable assignment
body: <p>I'm using a variable to store data that gets sent by a socket. When I assign it in my program it works but when I read it from a file it is treated as a string.</p>
  
  <p>Example:</p>
  
  <pre><code>data = '\x31\x32\x33'
  
  print data
  </code></pre>
  
  <p>Outputs</p>
  
  <pre><code>123   # &lt;--- this is the result I want when I read from a file to assign data
  
  
  f = open('datafile')  &lt;--- datafile contains \x31\x32\x33 on one line
  
  data = f.readline()
  
  print data
  </code></pre>
  
  <p>Outputs</p>
  
  <pre><code>\x31\x32\x33  # &lt;--- wanted it to print 123, not \x31\x32\x33. 
  </code></pre>