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

A61022. 文件text.txt 的内容如下:1 Python is a programming language.

单选题

题目描述

文件text.txt 的内容如下:

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

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

1 count = 0
2 with open("text.txt", "r") as f:
3  content = f.________ # 补全代码
4  words = content.split()
5  for word in words:
6   if word == "Python":
7    count += 1
8 print("Python出现次数:", count)


选项(单选)