第26240题 单选题
补全统计文件中'Python'单词出现次数的Python代码空缺部分

文件 text.txt 的内容如下:

Python is a programming language.
Python is easy to learn.

以下程序统计单词 "Python" 在文件中出现的次数(要求Python后面是空格或行尾,且不跟标点),请补全代码横线处的内容:

count = 0
with open("text.txt", "r") as f:
    content = f.________ # 补全代码
    words = content.split()
    for word in words:
        if word == "Python":
            count += 1
print("Python出现次数:", count)
{{ option.label }}
子题{{ index + 1 }} {{ child.type_label }}
{{ option.label }}
✓ 正确 ◐ 部分正确 ✗ 错误
程序运行统计
暂无判题统计
提交{{ questionInfo.stats ? questionInfo.stats.submit_count : 0 }}次 正确率{{ statsAccuracy }}%
答案解析