AttributeError: module ‘jieba‘ has no attribute ‘lcut‘

Error:

words = lcut(passage) #精确模式分词形式
NameError: name 'lcut' is not defined

If words = lcut(passage) is changed to words = jieba.lcut(passage), it does not work. Continue to report the error as shown below:

words = jieba.lcut(passage) #精确模式分词形式
AttributeError: module 'jieba' has no attribute 'lcut'

Reason search:

Obviously installed jieba, also imported

from jieba import *  

To

import jieba

Nor does it work.
Later, it was discovered that the file was named jieba.py and conflicted.

Solution:

Modify the file name, it's ok

Guess you like

Origin blog.csdn.net/weixin_47542175/article/details/113930525