您的位置:首页 > 编程语言 > Python开发

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='')
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: