1. 程式人生 > >python正則表達匹配漢字

python正則表達匹配漢字

import os
import codecs
import re


'''
Created on 2012-3-29
'''


log = codecs.open('wiki/tt.txt','r','gbk')
line = log.readline()


m = re.match(ur"[\u4e00-\u9fa5]",line[4])


if m is None:
    print 'none'
else:

    print 'yes'