测评会员优惠活动进行中 · 开通 VIP,有效期内测评不限次 VIP 优惠中 · 测评不限次 立即查看

A22206. 执⾏以下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 a…

单选题 较难

题目描述

执⾏以下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)

选项(单选)

上一题 下一题