python 正则使用笔记
生活随笔
收集整理的這篇文章主要介紹了
python 正则使用笔记
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
python正則使用筆記
def remove_br(content):"""去除兩邊換行符"""content = content.replace("<br>", "<br />").replace("<br >", "<br />")while re.findall("^<br />|<br />$", content):content = re.sub(r'^<br />|<br />$', "", content)return contentif __name__ == "__main__":s = remove_br("<br><br>ab<br />c<br><br>")print shttp://www.runoob.com/python/python-reg-expressions.html?
.
轉(zhuǎn)載于:https://www.cnblogs.com/weiok/p/5433578.html
總結(jié)
以上是生活随笔為你收集整理的python 正则使用笔记的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: PHP语言 -- Ajax 查询数据
- 下一篇: python 3.* + Eclipse