python用正则表达式怎么查询unicode码字符

时间:2014-05-22 17:26:17   收藏:0   阅读:293
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=‘‘)

python用正则表达式怎么查询unicode码字符,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!