A21059. 文件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.________ # 补…
单选题
较难
知识点
题目描述
文件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)选项(单选)
答案解析
详细答案解析为会员权益,按每日次数查看。
开通 / 升级会员
上一题
下一题