summaryrefslogtreecommitdiff
path: root/tests/io/file_seek.py
blob: d6be662cbfef17c98541b07afaf709cde04d2f69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
f = open("io/data/file1", "rb")
print(f.seek(6))
print(f.read(5))
print(f.tell())

print(f.seek(0, 1))
print(f.read(4))
print(f.tell())

print(f.seek(-6, 2))
print(f.read(20))
print(f.tell())

print(f.seek(0, 0))
print(f.read(5))
print(f.tell())

f.close()

# test text mode
f = open("io/data/file1", "rt")
print(f.seek(6))
print(f.read(5))
print(f.tell())
f.close()