擅长:python、mysql、java
<p>你也应该在badWord项上循环,对于每个项,你应该检查它是否存在于txentry中。你知道吗</p>
<pre><code>for txtEntry in txtList:
if any(word in txtEntry for word in badWord)::
myClassifier.append("bad") # append() is better and will give you the right output as += will add every letter in "bad" as a list item. or you should make it myClassifier += ['bad']
else:
myClassifier.append("good")
</code></pre>
<p>感谢@lvc评论</p>