title: How to convert string to byte array in Python
body: <p>Say that I have a 4 character string, and I want to convert this string into a byte array where each character in the string is translated into its hex equivalent. e.g.</p>
  
  <pre><code>str = "ABCD"
  </code></pre>
  
  <p>I'm trying to get my output to be </p>
  
  <pre><code>array('B', [41, 42, 43, 44])
  </code></pre>
  
  <p>Is there a straightforward way to accomplish this?</p>