题库 Python题库 题目列表 文件水果.txt中的内容如图所示:执行如下Python代码,...
单选题

文件水果.txt中的内容如图所示:

undefined

执行如下Python代码,输出的结果是?( )
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["苹果"])

A.

1

B.

2

C.

3

D.

4

题目信息
2023年 9月 选择题
-
正确率
0
评论
83
点击