Python-re模块的TypeError - Xiao-Le Deng (邓小乐)

Xiao-Le Deng (邓小乐)

HomeResearchPublicationsToolsDaoLifeTagsSearchAbout

Python-re模块的TypeError

2019-09-16
#Python

在使用re模块的findall()时,出现错误:

TypeError: expected string or bytes-like object

解决方案:对findall()的参数加上str()转换。

参考

  • python - re.sub erroring with “Expected string or bytes-like object” - Stack Overflow
——
2012 – 2025 © Xiao-Le Deng · Powered by Simple Style