Chinaunix

标题: 正则 [打印本页]

作者: tomer    时间: 2014-12-13 19:49
标题: 正则
import re
aa=re.sub(r'(\b[a-z]+) \1',r'\1','cat cat the in the the hat')
print(aa)

两个\1是啥意思
作者: HH106    时间: 2014-12-15 09:50
回复 1# tomer
google 正则 反向引用


   




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2