You are calling the re.compile()
function, whose second argument is an integer representing the different regular expression flags (such as IGNORECASE
or VERBOSE
).
Judging by your variable names, I think you wanted to use the re.findall()
function instead:
findall_localizacao_tema = re.findall(
':.? (*)' + findall_tema[0] + "https://stackoverflow.com/",
arquivo_salva)
You can still use re.compile
, but then you must use store the resulting regex
instance and call the regex.findall()
method:
pattern = re.compile(':.? (*)' + findall_tema[0] + "https://stackoverflow.com/")
findall_localizacao_tema = pattern.findall(arquivo_salva)
Not that your expression is actually valid; you cannot use *
without something to repeat; nothing precedes your the quantifier (the (
doesn’t count as it defines a group with the )
).
9
solved TypeError: unsupported operand type(s) for &: ‘str’ and ‘int’ on compile re [closed]