Pythonの標準ライブラリである"re"を使用して正規表現を扱います。標準ライブラリのため環境構築などは不要です。 re --- 正規表現操作 ソースコード: Lib/re/ このモジュールは Perl に見られる正規表現マッチング操作と同様のものを提供します。 パ docs.python.org ...
Regular expressions (regex) can be used to remove special characters from a string in Python. The re.sub() function can be used to replace a pattern in a string with an empty string. The pattern can ...
I'm pretty sure you need two calls to re.sub. This isn't a Python issue so much as a regular expression issue, and as far as I know this isn't possible.