Python:Python正则表达式指南
来源:互联网 发布:测斜仪数据计算 编辑:程序博客网 时间:2024/05/01 02:16
文章地址:http://www.cnblogs.com/huxi/archive/2010/07/04/1771073.html。
实践:
1.匹配包含子串‘abc’的所有单词:
刚开始想复杂了,总想着一行的开头和结尾怎么办。。。其实只要用\w开头就好了,自动屏蔽了开头和空格
str = 'abc sabc abcccccc abddd abccc'p = re.compile(r'\w*abc+')print p.findall(str)输出结果:['abc', 'sabc', 'abcccccc', 'abccc']
2.
0 0
- Python正则表达式指南
- Python正则表达式指南
- Python 正则表达式指南
- Python正则表达式指南
- python正则表达式指南
- python正则表达式指南
- Python正则表达式指南
- python 正则表达式指南
- Python正则表达式指南
- Python正则表达式指南
- python正则表达式指南
- Python正则表达式指南
- Python正则表达式指南
- Python正则表达式指南
- Python正则表达式指南
- Python正则表达式指南
- Python正则表达式指南
- Python正则表达式指南
- 关于数组的复习以及定义一个类(关于内存的理解)
- servlet/JSP自定义标签/Filter/Listener/新特性
- 快速排序算法 C语言实现
- 叶君--国画作品“万山红遍”被中南海收藏
- c++程序学习
- Python:Python正则表达式指南
- linux下mysql-5.5.27.tar.gz源程序包安装实例
- 需求分期三步走
- C#中JSON数组填充给Combox控件
- 叶君—国画大师笔下的“忠义千秋”
- mysql必知必会 第十三章 分组数据
- The Struts dispatcher cannot be found在struts2中出现的问题
- 叶君.画梅大师
- c++程序!