部分代码如下,运行后总是提示 Traceback (most recent call last):
File "E:\project1\src\neirongxiangguanxing.py", line 156, in
setstatus = set(statuslist)
TypeError: 'NoneType' object is not iterable,什么原因?有没有大神指导下?非常感谢
for status in allstatus:
dictvalue = []
words = jieba.cut(status.gettext()[:-1])
for word in words:
if word not in stopwordslist:
dictvalue.append(word)
allstatusdict[status.getid()] = dictvalue
allcomments = []
allcomments = readallcomments(inputfile)
for comment in allcomments:
statuslist = allstatusdict.get(comment.getid())
setstatus = set(statuslist)
dictcomment = []
words = jieba.cut(comment.gettext()[:-1])
for word in words:
if word not in stopwordslist:
dictcomment.append(word)
setcomment = set(dictcomment)