title: how to convert a byte array with an ascii decimal number to integer in Python 3
body: <p>I am trying to communicate serially with an arduino which is sending me the results of polling an ADC channel, in the form of an ASCII string with the decimal result, which is normally appended with an EOT character ('\x04').
  so typical results I might expect from PySerial are:</p>
  
  <pre><code>b'0\x04'
  </code></pre>
  
  <p>for the integer 0, or </p>
  
  <pre><code>b'293\x04'
  </code></pre>
  
  <p>for the integer 293, or even</p>
  
  <pre><code>b'1023\x04'
  </code></pre>
  
  <p>for the highest possible value, 1023.</p>
  
  <p>On the PC side i'm running python 3.2 (on Windows 7).</p>
  
  <p>I want to convert the received bytes from PySerial into an integer, so I can calculate with them.</p>
  
  <p><strong>How do I convert the byte array into an integer?</strong></p>
  
  <p>I am able to stop the arduino from sending the EOT character after the numerical value, but it is probably safer to leave them in.</p>
  
  <p>I'm a beginner with Python, but not so much with C.</p>