python 正则使用笔记
2016-04-26 06:47
453 查看
python正则使用笔记
http://www.runoob.com/python/python-reg-expressions.html
.
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 content if __name__ == "__main__": s = remove_br("<br><br>ab<br />c<br><br>") print s
http://www.runoob.com/python/python-reg-expressions.html
.
相关文章推荐
- 在注册表中无Python3.5安装路径的情况下安装pywin32-
- Python基础
- Python抓取有道翻译,得到在线翻译结果
- Python 3.4 printf的用法
- Mac 随机启动Python脚本服务
- Python入门简单的静态网页爬虫2.0 (实现各模块的具体方法)
- 1.3Python快速入门
- 1.4Python环境准备
- 1.5Python基础
- python urllib的用法实例
- 学习python第一周
- Python自动化运维--系统基础信息模块
- pythonchallenge初试
- 使用Python脚本强化LLDB调试器
- 自动化 测试框架部署(python3+selenium2)
- Python编程-字符串的编码转换、存储及乱码问题
- 利用python,基于SVM实现文本分类
- Python 进阶 —— x = x+1 vs x += 1
- Python学习-机器学习实战-ch06 支持向量机
- Python collections.defaultdict()与dict的使用和区别