summaryrefslogtreecommitdiff
path: root/tests/io/file_readinto.py
blob: 1f3702a217e6001d0abd9a97f8339648d105e842 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
b = bytearray(30)
f = open("io/data/file1", "rb")
print(f.readinto(b))
print(b)
f = open("io/data/file2", "rb")
print(f.readinto(b))
print(b)

# readinto() on writable file
f = open("io/data/file1", "ab")
try:
    f.readinto(bytearray(4))
except OSError:
    print("OSError")