title: Working with bytes and binary data in Python
body: <p>Four consecutive bytes in a byte string together specify some value. However, only 7 bits in each byte are used; the most significant bit is always zero and therefore its ignored (that makes 28 bits altogether). So...</p>
  
  <pre><code>b"\x00\x00\x02\x01"
  </code></pre>
  
  <p>would be <code>000 0000</code> <code>000 0000</code> <code>000 0010</code> <code>000 0001</code>.</p>
  
  <p>Or, for the sake of legibility, <code>10 000 0001</code>. That's the value the four bytes represent. But I want a decimal, so I do this:</p>
  
  <pre><code>&gt;&gt;&gt; 0b100000001
  257
  </code></pre>
  
  <p>I can work all that out myself, but how would I incorporate it into a program?</p>