网站首页
编程语言
数据库
系统相关
其他分享
编程问答
python0035
2024-05-26
8-3 【Python0035】英文统计
编写程序实现对特定英文文章(文本文件)的单词数和有效行数的统计,其中要求空行不计数; defcount_words_and_lines(filename):word_count=0line_count=0withopen(filename,'r')asfile:forlineinfile:stripped_line=line.strip()ifs