numF + = 1未正确返回 [英] numF += 1 doesn't return correctly
本文介绍了numF + = 1未正确返回的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
另一个任务,另一个问题。我正在写一个一致性,并且开始我试图让它找到一个单词并正确计算它。这是我的代码:
Another assignment, and another question. I am writing a concordance, and just to begin I''m trying to get it to find a word and count it correctly. Here is my code:
展开 | 选择 | Wrap | / span> 行号
推荐答案
另一个任务,另一个问题。我正在写一个一致性,并且开始我试图让它找到一个单词并正确计算它。这是我的代码:
Another assignment, and another question. I am writing a concordance, and just to begin I''m trying to get it to find a word and count it correctly. Here is my code:
展开 | 选择 | Wrap | / span> 行号
另一项任务和另一个问题。我正在写一个一致性,并且开始我试图让它找到一个单词并正确计算它。 ........................
.................. .....................
我们将非常感谢您的帮助。 :)
TMS
Another assignment, and another question. I am writing a concordance, and just to begin I''m trying to get it to find a word and count it correctly. ........................
.......................................
Your help would be appreciated. :)
TMS
有更好的方法来计算字数:
- 使用''f.readlines()''将文件读入列表
- 创建单词列表 - wordList ="" .join(fList).split ()
- 使用list方法 wordList.count(''word'')来计算单词的出现次数。
- Use ''f.readlines()'' to read the file into a list
- Create a word list - wordList = "".join(fList).split()
- Use list method wordList.count(''word'') to count the occurances of the word.
- 使用''f .readlines()''将文件读入列表
- 创建单词列表 - wordList = " .join(fList).split()
- 使用list方法 wordList.count(''word'')来计算出现的次数单词。
- Use ''f.readlines()'' to read the file into a list
- Create a word list - wordList = "".join(fList).split()
- Use list method wordList.count(''word'') to count the occurances of the word.
There is a better way to get a word count:
有一个更好的方法来获得一个字数:
There is a better way to get a word count:
Nice,BV。我不得不承认list.count()的无知。它表明我们可以更多地阅读文档或执行诸如
Nice, BV. I have to admit ignorance of list.count(). It shows that we can all read the docs more or do things like
展开 | 选择 | Wrap | 行号
这篇关于numF + = 1未正确返回的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文