python用正则表达式怎么查询unicode码字符
2014-05-21 14:19
225 查看
import re
data = open('a.txt')
fh = open('b.txt', 'w')
"""Search the string begining with '【'"""
p = re.compile(r'\s*[\u3010]')
for each_d in data:
if re.match('\s*3\d{4}', each_d):
each_d = each_d.strip()
print(each_d + ': ', end='')
elif p.match(each_d):
print(each_d, end='')
data = open('a.txt')
fh = open('b.txt', 'w')
"""Search the string begining with '【'"""
p = re.compile(r'\s*[\u3010]')
for each_d in data:
if re.match('\s*3\d{4}', each_d):
each_d = each_d.strip()
print(each_d + ': ', end='')
elif p.match(each_d):
print(each_d, end='')
相关文章推荐
- Python - re - 正则表达式 - 怎么用
- python爬虫由浅入深8---基于正则表达式查询的淘宝比价定向爬虫
- Python 正则表达式在文本查询URL
- Python 正则表达式查询相似的字符串
- Python正则表达式返回首次匹配到的字符及查询的健壮性
- 怎么用正则表达式判断数字(包括正,负,小数。。)
- 正则表达式不包含align该怎么写
- 用正则表达式突出显示字符串中查询到的单词的函数
- 正则表达式在python中的应用
- Python用re(正则表达式)模块过滤Telnet字体颜色
- Java正则表达式:不包含某些字符串 怎么写?
- Python正则表达式操作指南
- 转载:Python正则表达式的用法(2. 替换;3.拆分)
- 正则表达式几种常用功能——查询,提取,替换,分割
- Python正则表达式操作指南
- Python正则表达式操作指南
- Python正则表达式的用法(2. 替换;3.拆分)
- 转载:Python正则表达式的用法(1. 匹配)
- Python正则表达式的用法(1. 匹配)
- 正则表达式几种常用功能—查询,提取,替换,分割