title: How to convert a 8-bit number to an actual byte in Python?
body: <p>Say I have 8 bits </p>
  
  <pre><code>01010101
  </code></pre>
  
  <p>which equals the byte </p>
  
  <pre><code>u
  </code></pre>
  
  <p>But I what I actually have is 8 binaries(well, integers). How do I convert these 8 binaries to the corresponding byte?</p>
  
  <p>I'm trying </p>
  
  <pre><code>byte = int(int('01010101'), 2)
  byte = chr(byte)
  byte = bytes(byte)
  </code></pre>
  
  <p>But this gives me a bytes array instead of a single byte...</p>