AttributeError:当我执行reg exp时,“ int”对象没有属性“ match”

时间:2018-08-15 19:05:12

标签: python python-2.7

我正在尝试读取文件,并尝试下面的正则表达式来查找特定字符串的存在,但是最终出现跟随错误。

if re.match("(.*)hello.%s_world"%(str(what_name)), lines):

出现以下错误:

AttributeError: 'int' object has no attribute 'match'

可能是基本错误或问题?请澄清一下!

更新: 当我复制相同的文件并尝试做一个小实验时,它可以正常工作。但是,当我在较大的脚本中尝试相同操作时,出现上述错误!

0 个答案:

没有答案