The function:
def write_file():
f = open('image.txt', 'wb')
byte_arr = getbytes(read_bits())
byte_list = list(byte_arr)
print(byte_list)
some_bytes = bytearray(byte_list)
print(bytes(some_bytes))
st = bytes(some_bytes).decode('latin1')
immutable_bytes = bytes(some_bytes)
with open('test','wb') as f:
f.write(immutable_bytes )
The output is like:
[255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0]
b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00'
I want to write string value converted from this list of byte values.