Write
Read
Append
Read and Write Both
raise
goto
try
except
seek()
read()
close()
tell()
move()
shift()
w
rb
rt
r
Data is appended
Error occurs
Old content is erased
Nothing happens
random
sys
math
os
End Of Folder
Exit Open File
End Of File
Error On File
readlines()
readline()
readlist()
readall()
What happens if the file does not exist?
f = open("abc.txt", "r")
New file is created
FileNotFoundError
Returns None
Opens empty file
What will be written to the file?
f = open("test.txt", "w") f.write("ABC") f.write("DEF") f.close()
ABC
DEF
ABCDEF
Error
What is the output?
f = open("test.txt", "w") f.write("Python") print(f.tell()) f.close()
5
6
7
0
File size
Current file pointer position
Number of lines
Number of characters remaining
a
r+
What will be the output?
f = open("test.txt", "w") f.write("Python") f.seek(0) print(f.read())
Python
Empty String
UnsupportedOperation Error
None