micropython/tests/io/file_seek.py

21 lines
287 B
Python
Raw Normal View History

2014-11-16 22:16:14 +00:00
f = open("io/data/file1", "rb")
print(f.seek(6))
print(f.read(5))
print(f.seek(0, 1))
print(f.read(4))
print(f.seek(-6, 2))
print(f.read(20))
print(f.seek(0, 0))
print(f.read(5))
f.close()
# test text mode
f = open("io/data/file1", "rt")
print(f.seek(6))
print(f.read(5))
f.close()