title: How can I create byte values from integers in Python?
body: <p>Background: I need to send a numerical value as a byte to an external device, but I have run into a problem.
  My code is:</p>
  
  <pre><code>ser=serial.Serial("COM3",9600, timeout=0)
  ser.write(value)
  </code></pre>
  
  <p>where "value" is an int that I read have read.  The problem is, when I send this, it sends the character value, not the actual value (it sends the byte value 31 for the number 5, since that is the unicode position for it, I believe)</p>
  
  <p>In reality, I want to be able to send it the character "\x05" for example.  I guess my question is, how would I convert and int 5 to a char "\x05", or 37 to "\x37"</p>