title: Interpret str as hex character sequence
body: <p>I am working on developing a checksum function where 4 bytes are converted to a string of characters in hexadecimal (eg. '00ABCDEF') listed below:</p>
  
  <pre><code>packet = "004100ff"
  checksum = 0
  for el in packet:
      checksum ^= ord(el)
  print (hex(checksum))
  </code></pre>
  
  <p>Currently, the only way to obtain the correct checksum (0xbe) is to manually rewrite the string as packet = '\x00\x41\x00\xff' which cannot be done automatically.</p>
  
  <p><strong>How could I make python interpret the string as if each 2 characters were bytes in hexadecimal to perform the checksum?</strong></p>