import sys
def read_file(fpath):
BLOCK_SIZE = 1024
with open(fpath, 'rb') as f:
while True:
block = f.read(BLOCK_SIZE)
if block:
yield block
else: T
return
r = read_file(r'C:\Users\Administrator\Desktop\ppp.pdf')
while True:
try:
print(next(r))
except StopIteration:
sys.exit()