PCAP Exceptions and File I/O • Set 4
PCAP Exceptions and File I/O Practice Test 4 — 15 questions with explanations. Free, no signup.
Refer to the exhibit. If the file config.cfg exists but the user does not have read permission, what will be printed?
try:
with open('config.cfg', 'r') as f:
data = f.read()
except FileNotFoundError:
print('File not found')
except PermissionError:
print('Permission denied')