正则表达式中有中文,是不是必须要转码?
# -*- encoding=utf8 -*-import re
# pattten=re.compile('*人*')
patten=re.compile(u'人'.encode('utf8'))
message = u'some abd 123 人民'.encode('utf8')
print(re.search(patten, message).group())
正则中直接写中文提示raise error("nothing to repeat")
sre_constants.error: nothing to repeat 是必须要转码?
我对jaca不熟,还真不懂。
页:
[1]