第14656题 单选题
执行统计水果.txt中水果出现次数的Python代码,输出结果是?

水果.txt中每行存储一个水果,内容依次为:香蕉、苹果、西瓜、西瓜、苹果、橘子、西瓜、西瓜、苹果、橘子。

s = {}
with open('水果.txt') as f:
    a = f.readlines()
for i in a:
    if i in s:
        s[i] += 1
    else:
        s[i] = 1
print(s["苹果"])
{{ option.label }}
子题{{ index + 1 }} {{ child.type_label }}
{{ option.label }}
✓ 正确 ◐ 部分正确 ✗ 错误
程序运行统计
暂无判题统计
提交{{ questionInfo.stats ? questionInfo.stats.submit_count : 0 }}次 正确率{{ statsAccuracy }}%
答案解析