繁体   English   中英

导入模块,但解释器无法识别该模块python中的功能

[英]Importing a module but the interpreter is not recognizing the function in that module python

我正在将标记化模块导入到我的项目中。 标记导入regexp.py

当我尝试在程序中调用位于regexp.py中的函数时

m = tokenize.regexp_tokenize(itemToString.lower(), n)

我收到一个错误的“模块”对象,没有属性“ regexp_tokenize”。

regexp_tokenize是regexp.py中的一个函数。

知道可能是什么问题吗? 提前致谢

您说自己是导入的tokenize,而不是regexp。 如果regexp_tokenize位于regexp中,则需要自己导入regexp。

可以通过tokenzie.regexp.regexp_tokenize访问它,但这不是通常的做法。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM