我需要帮助整理文本文件
我试过多种不同的for循环。我还试着去掉所有空格,并在文件中逐个计算字母数。我还尝试了strip函数的多种变体和不同的if语句
for character in file: if character.isupper(): capital += 1 file.readline().rstrip() break print(capital)
我希望程序读取文档中的每个单词或字母,并返回其中包含的大写单词总数。