import re
s='Phone 34No. 010-087-65-43-2-1'
m=re.findall(r'\d+$',s)
if m:
# 使用Match获得分组信息
print(m)
key = r"<html><body><h1>hello world<2h1>132<h1>hello 224world<2h1>rtd</body></html>"#匹配的文本
p1 = r"(?<=<h1>).+?(?=<2h1>)
pattern1 = re.compile(p1)#编译这段正则表达式
matcher1 =re.findall(pattern1,key)#搜索符合正则表达式的部分
if matcher1:
print(matcher1)
p1=r"<h1>(.*?)<2h1>"
p1中的东西是通用公式。