2014-11-16 17:16:14 -05:00
|
|
|
f = open("io/data/file1", "rb")
|
|
|
|
print(f.seek(6))
|
|
|
|
print(f.read(5))
|
2015-08-04 19:45:30 -04:00
|
|
|
print(f.tell())
|
2014-11-16 17:16:14 -05:00
|
|
|
|
|
|
|
print(f.seek(0, 1))
|
|
|
|
print(f.read(4))
|
2015-08-04 19:45:30 -04:00
|
|
|
print(f.tell())
|
2014-11-16 17:16:14 -05:00
|
|
|
|
|
|
|
print(f.seek(-6, 2))
|
|
|
|
print(f.read(20))
|
2015-08-04 19:45:30 -04:00
|
|
|
print(f.tell())
|
2014-11-16 17:16:14 -05:00
|
|
|
|
|
|
|
print(f.seek(0, 0))
|
|
|
|
print(f.read(5))
|
2015-08-04 19:45:30 -04:00
|
|
|
print(f.tell())
|
2014-11-16 18:56:37 -05:00
|
|
|
|
|
|
|
f.close()
|
|
|
|
|
|
|
|
# test text mode
|
|
|
|
f = open("io/data/file1", "rt")
|
|
|
|
print(f.seek(6))
|
|
|
|
print(f.read(5))
|
2015-08-04 19:45:30 -04:00
|
|
|
print(f.tell())
|
2014-11-16 18:56:37 -05:00
|
|
|
f.close()
|