python regular expression basic
来源:互联网 发布:coc狂暴升级数据 编辑:程序博客网 时间:2024/05/16 02:06
# regex.py by Bill Weinman [http://bw.org/]
# This is an exercise file from Python 3 Essential Training on lynda.com
# Copyright 2010 The BearHeart Gorup, LLC
import re
def main():
fh = open('raven.txt')
for line in fh:
if re.search('(Len|Neverm)ore', line):
print(line, end='')
if __name__ == "__main__": main()
#!/usr/bin/python3
# regex.py by Bill Weinman [http://bw.org/]
# This is an exercise file from Python 3 Essential Training on lynda.com
# Copyright 2010 The BearHeart Gorup, LLC
import re
def main():
fh = open('raven.txt')
for line in fh:
print(re.sub('(Len|Neverm)ore','###', line),end=' ')
if __name__ == "__main__": main()
------预编译
#!/usr/bin/python3
# regex.py by Bill Weinman [http://bw.org/]
# This is an exercise file from Python 3 Essential Training on lynda.com
# Copyright 2010 The BearHeart Gorup, LLC
import re
def main():
fh = open('raven.txt')
pattern=re.compile('(Len|Neverm)ore')
for line in fh:
if re.search(pattern, line):
print(pattern.sub('###',line), end='')
if __name__ == "__main__": main()
- python regular expression basic
- Java-Regular Expression Basic
- Regular Expression Basic Syntax Reference
- [Python]Regular Expression Syntax
- python regular expression
- Python Regular Expression
- Regular Expression Python
- regular expression matching --python
- Regex - Regular Expression Basic Syntax Reference
- [Python]Regular Expression Syntax(CHN)
- leetcode10 Regular Expression Matching @python
- 【LeetCode with Python】 Regular Expression Matching
- Python Regular Expression——简介
- Python re(regular expression operation) Module
- 10. Regular Expression Matching Leetcode Python
- [Leetcode]10. Regular Expression Matching @python
- Leetcode(python)--10.Regular Expression Matching
- regular expression
- win7 下ffmpeg release 版本崩溃问题
- protocol Buffer
- Lucky Number
- Triangle --找三角形数组中最小的路径(重重重)
- oracle的mybatis批量插入(转)
- python regular expression basic
- java基础复习(3)
- const int *p,const * int p,int const *p
- 越狱开发相关
- ArcSDE:C#打开SDE数据库的几种方式总结
- 判断两个线段是否相交
- Windows进程通信之内存映射文件
- 向Android虚拟机发送短信和拨打电话
- 观察者设计模式