title: How to get range of bits from byte in python?
body: <p>Want to extract bits from a binary or integer value. 
  From one end i am sending <code>hex</code> value of <code>01 00 00</code> in a byte array.After receiving in other end, converting into integer then try to get range of bits from that. <code>hex(100000) = 65536</code>. Now i want range of bits from this value.</p>
  
  <pre><code>
  input_2 = 65536
  result= bin(input_2)
  </code></pre>
  
  <p>The problem here is , its 3 byte(24bits) data so it should able give 19-24 bits value.</p>
  
  <pre><code>0001 0000 0000 0000 0000 0000
  </code></pre>
  
  <p>so i want bit range from 19-24. How can i do?</p>