title: How to convert between the byte format that looks like [8, 200, 1, 16] to the one that looks like b'\x08\xc8\x01\x10\xc8 in python
body: <p>I'm not sure what this type of byte array format is called in python:<br>
  <strong>Format A:</strong><br>
  <code>[8, 200, 1, 16, 200, 1, 24, 200, 1, 34, 21, 8, 1, 18, 17, 98, 97, 116, 116, 108, 101, 95, 116, 97]</code><br>
  but I'd like to convert it into this format (the name of which I’m also unsure of):<br>
  <strong>Format B:</strong><br>
  <code>b'\x08\xc8\x01\x10\xc8\x01\x18\xc8\x01"\x15\x08\x01\x12'</code></p>
  
  <p>I know how to get from Format B to Format A:<br>
  <code>import array
  data =b'\x08\xc8\x01\x10\xc8'
  print array.array('B', data))
  </code>
  but I'm unsure of how to get from Format A to Format B, and because I also don't know the names of either format, the google results I've gotten have been sparse. </p>