title: Python - binascii.unhexlify and .decode("hex") return TypeError: Non-hexadecimal digit found
body: <p>I've searched this extensively but cannot find a post that fixes this issue. I have a simple string that I've received from a modem of <code>82001B014042</code>. I want to disregard the preceding header of <code>82001B01</code> and decode the hex digits <code>4042</code>. My code is as follows;</p>
  
  <pre><code>rxHEX = ser.readline()
  print rxHEX         #82001B014042
  rxData = rxHEX[8:]  #4042
  print rxData
  #rxData = "4042"
  rxData = rxData.decode("hex")
  #rxData = binascii.unhexlify(rxData)
  print rxData
  </code></pre>
  
  <p>Regardless if I use <code>.decode("hex")</code> or <code>binascii.unhexlify(rxData)</code> I receive </p>
  
  <blockquote>
    <p><em>TypeError: Non-hexadecimal digit found</em></p>
  </blockquote>
  
  <p>If I un-hash <code>#rxData = "4042"</code> it returns <em>@S</em> which is what I'd expect.</p>
  
  <p>Why won't it work from what is received from the modem string?</p>
  
  <p>If I only have </p>
  
  <pre><code>rxHEX = ser.readline()
  print rxHEX
  rxData = rxHEX[8:]
  print rxData
  I recieve
  </code></pre>
  
  <p>The output is </p>
  
  <blockquote>
    <p>82001F014042<br>
    4042</p>
  </blockquote>