# -*- coding: utf-8 -*-
import re
def findPart(regex, text, name):
res=re.findall(regex, text)
if res:
print "There are %d %s parts:n"% (len(res), name)
for r in res:
print "t",r.encode("utf8")
print
text ="#who#helloworld#a中文x#"
usample=unicode(text,'utf8')
findPart(u"#[wu2E80-u9FFF]+#", usample, "unicode chinese")
(
#!/usr/bin/python3
# -*- coding: UTF-8 -*-
import re
message = u'天人合一'.encode('utf8')
print(re.search(u'人'.encode('utf8'), message).group())
交互模式下的例子
>>> import re
>>> s='Phone No. 010-87654321'
>>>
>>> r=re.compile(r'(d+)-(d+)')
>>> m=r.search(s)
>>> m
<_sre.SRE_Match object at 0x010EE218>
)
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有