Why does this work,
>>>> import os >>>> FILENAME="sample.txt" >>>> f = open(FILENAME, 'rb') >>>> data = bytearray(os.path.getsize(FILENAME)) >>>> f.readinto(data) 12 >>>> data bytearray(b'abc def\ngeh\n')But this doesn't?
>>>> f = open(FILENAME, 'rb') >>>> data = bytearray(os.path.getsize(FILENAME)) >>>> f.readinto(data[0:]) 12 >>>> data bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')