# req = bytes((1, 2, 3), encoding='utf-8') foo = 12 req = bytearray((1, 2, 3)) req += foo.to_bytes(2, 'big') print(type(foo.to_bytes(2, 'big'))) print(req)