Apr-26-2022, 03:35 PM
1 Astring and Bstring aren't strings, they're lists. Is there a reason you have the brackets around them? Does the findall() call generate an error about passing in an unhashable type?
2 The re module uses regular expressions, not globs. The initial
3 re.findall takes a pattern and a string to match. You're passing them in backward.
Changing those things:
2 The re module uses regular expressions, not globs. The initial
*
in Bstring isn't legal and the dots will match anything. 3 re.findall takes a pattern and a string to match. You're passing them in backward.
Changing those things:
>>> a = '123.456.789.10.11.12.abc' >>> b = '.*.456.789.*.11.12.*' >>> re.findall(b,a) ['123.456.789.10.11.12.abc']