AI题库 · GESP-Python四级题库
题目分享 #17012
执行以下Python代码,如果文件data.txt不存在,输出结果是? ( )
try:
with open('data.txt', 'r') as f:
content = f.read()
print("File read successfully.")
except FileNotFoundError:
print("File not found.")
except Exception as e:
print("An error occurred : ", e)
A
File read successfully.
B
File not found.
C
An error occurred : ...
D
没有任何输出
AI题库 · 编程考级与信奥赛真题库
查看答案 →
复制链接后可在微信、QQ、小红书等平台粘贴分享;答案与解析在题目页。