title: Creating Byte Object in Python3.x
body: <p>I have a question considering python3. I am already trying for a few days to create a byte object, which looks like these: </p>
  
  <pre><code>b"'\x10\x00\x0020180425"
  </code></pre>
  
  <p>The first part '\x10\x00\x00 are two int16 objects which were combined. This is how I tried it to combine them: </p>
  
  <pre><code>array = [0,0,0,0,1,9,7,0,0,1,0,1]
  blebytes = bytearray(array)
  
  z = np.int16(20)
  blebytes[0] = (z &amp; 0xFF00) &gt;&gt; 8
  blebytes[1] = (z &amp; 0x00FF)
  
  z = np.int16(123)
  blebytes[2] = (z &amp; 0xFF00) &gt;&gt; 8
  blebytes[3] = (z &amp; 0x00FF)
  </code></pre>
  
  <p>The second part(20180425) is just the date of today. I am trying to do this like this: </p>
  
  <pre><code>datestr = time.strftime("%Y%m%d")
  for i in range(0,8):
      blebytes[i+4] = np.int16(datestr[i])
  print(blebytes)
  </code></pre>
  
  <p>But if I print my blebytes array, it looks like this: </p>
  
  <pre><code>bytearray(b'\x04\xe8\t\xf7\x02\x00\x01\x08\x00\x04\x02\x05')
  </code></pre>
  
  <p>What am I doing wrong? Can someone help me? </p>