examples/files/read_binary.py
filename = 'README'

try:
    with open(filename, 'rb') as fh:
        while True:
            str = fh.read(5000)
            print(len(str))
            if len(str) == 0:
                break
            # do something with the content of the str

    fh.close()
except Exception:
    pass

# 5000
# 5000
# 5000
# 1599
# 0