如何在 Python 正则表达式中使用通配符?
pythonserver side programmingprogramming更新于 2023/11/9 12:46:00
以下代码使用 Python 正则表达式 .() 点字符作为通配符,代表换行符以外的任何字符。
示例
import re rex = re.compile('th.s') l = "this, thus, just, then" print rex.findall(l)
输出
这给出了输出
['this', 'thus']