用python(V1.0)如何匹配HTML标签的实际操作
下的文章就是对python(V1.0)在实际相关应用方案的具体应用,如果你对python(V1.0)在匹配HTML标签的具体应用方案的具体介绍,如果你对其感兴趣的话,你就可以点击我们的文章。
匹配HTML标签
#coding:utf-8
import re
nStr = "<div>"
p = re.compile('</?\w+[^>]*>',re.I)
if p.match(nStr):
print "exists" 输出
else: print "not"
URL相关匹配EMAIL地址
import re nStr = "[email protected]" p = re.compile('^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$',re.S) if p.match(nStr): print "exists" else: print "not"
python(V1.0) 匹配URL