You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
261 B
15 lines
261 B
4 years ago
|
f = open("io/data/file1")
|
||
|
print(f.readline())
|
||
|
print(f.readline(3))
|
||
|
print(f.readline(4))
|
||
|
print(f.readline(5))
|
||
|
print(f.readline())
|
||
|
|
||
|
# readline() on writable file
|
||
|
f = open('io/data/file1', 'ab')
|
||
|
try:
|
||
|
f.readline()
|
||
|
except OSError:
|
||
|
print('OSError')
|
||
|
f.close()
|