Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
正規表現を定義しようとしIGNORECASEていて、ドットはすべて一致します。 次のコード:
IGNORECASE
str = "Test " a = re.findall(r"(\w+)", str, re.IGNORECASE, re.S)
エラーを取得する
TypeError: findall() takes at most 3 positional arguments (4 given)
複数のフラグは、ビット単位の OR で指定できます。たとえば、フラグとフラグre.I | re.Mの両方を設定します。IM
re.I | re.M
I
M
したがって、ビット単位またはフラグ:
str = "Test " a = re.findall(r"(\d+)", str, re.IGNORECASE|re.S)