title: Python3 Byte Level Bit Operations
body: <p>Is there a byte type in Python3? I only know there is a bytearray.</p>
  
  <p>What I want is that, there is a byte <code>0x01</code>, then do the Complement Operator <code>~</code> the result will be <code>0xFE</code>, however when I do the following steps, the result is <code>-2</code> and <code>-2</code> can't be added to the bytearray.</p>
  
  <pre><code>&gt;&gt;&gt; data=bytearray([0x01])
  &gt;&gt;&gt; data
  bytearray(b'\x01')
  &gt;&gt;&gt; ~data[0]
  -2
  &gt;&gt;&gt; data[0]=~data[0]
  Traceback (most recent call last):
      File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  ValueError: byte must be in range(0, 256)
  </code></pre>