I
AttributeError
Traceback (most recent call last)
/var/folders/lL/vixrwptn2399wc9_phg22wr0000gn/T/ipykernel_50661/2185895574.pyin<mod
5 text1 = pseg-cut(评论内容)
6 text2 = [[pair word, pair.flag] for pair in text1]
7 text1.append (text2)
AttributeError:
'generator' object has no attribute 'append'
text1 = pseg-cut(评论内容)
在这一步里text1被重新赋值了一个生成器对象,而不再是列表了,所以不能使用append方法。要么你改成text1.append(list(pseg-cut(评论内容)))试试