Agree, D is correct:
try:
f = open("linije","w")
print(1, end="")
s = f.readline()
print(2, end="")
except IOError as error:
print(3, end="")
else:
f.close()
print(4,end="")
The IOError exception is raised by the line s = f.readline() because the file was opened in write mode ('w'), and readline() tries to read from a file opened in write mode, which is not allowed.
D
s = f.readline() --> io.UnsupportedOperation: not readable
upvoted 2 times
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
vlobachevsky
Highly Voted 3 years, 1 month agomazimir
3 years, 1 month agoDamon54
Most Recent 9 months, 3 weeks agomplopez
1 year, 2 months agoJanpcap123
1 year, 2 months agodicksonpwc
1 year, 7 months ago9prayer
1 year, 9 months agoMallie
1 year, 11 months agoJnanada
2 years, 3 months agoBaldridge
2 years, 6 months agomacxsz
2 years, 6 months agoMTLE
2 years, 7 months agomacxsz
2 years, 7 months agoNoarmy315
2 years, 11 months ago