📜  python 从字符串正则表达式中删除文章 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:55.770000             🧑  作者: Mango

代码示例1
# credit to the Stack Overflow user in the source link

re.sub('(\s+)(a|an|and|the)(\s+)', '\1\3', text) # leaves the residual whitespace

re.sub('\s+(a|an|and|the)(\s+)', '\2', text) # removes the whitespace