title: Remove '\x' from bytes
body: <p>I'm currently reading bytes from a file and I want to put two of these bytes into a list and convert them into an integer. Say the two bytes I want to read are <code>\x02</code> and <code>\x00</code> I want to join these bytes together before I convert them into an integer such as <code>0x0200</code> but am having difficulty doing so as I cannot remove the <code>\x</code> from the bytes. </p>
  
  <p>I've tried using: <code>.replace('\\x', '')</code> though this doesn't work as python treats the bytes as one object rather than a list. I've also considered using struct although I'm unsure whether this would work in my situation.</p>
  
  <p>It's also not possible to iterate through each byte and remove the first two items as python still treats the entire byte as one object.</p>
  
  <p>Here is the list I have after appending it with both bytes:</p>
  
  <p><img src="https://i.stack.imgur.com/IZXsu.png" alt=""></p>
  
  <p>While it looks like two strings, they do not behave as strings. I then iterated over the list using:</p>
  
  <pre><code>for x in a:
      print a
  </code></pre>
  
  <p>The two lines below the list are the outputs of 'print a' (a blank space &amp; special character). As you can see they do not print as normal strings.</p>
  
  <p>Below is a code snippet showing how I add the bytes to the array, nothing complicated (test being the array in this case). </p>
  
  <pre><code>for i in openFile.read(512):
      ....
      ....
      elif 10 &lt; count &lt; 13:
          test.insert(0, i[0:])
  </code></pre>