with open('test.txt', 'r+b') as f: b = f.read(10) print(b)