完美解决AttributeError: module ‘string’ has no attribute ‘find’
文章目录
- 报错问题
- 解决方法
- 声明
报错问题
之前在工作中遇到过这个坑,记录一下问题以及解决方法,不一定针对所有情况都能用,但是可以供大家参考。
问题描述如下:
AttributeError: module ‘string’ has no attribute ‘find’
属性错误:模块“string”没有属性“find”
解决方法
因为python版本升级,函数名称已有改变!只需要将string改为str即可!
if str.find(big_string, substring) != -1:
return substring
声明
解决方法参考网络,如有侵权联系我删除