re.compile匹配

import re
string = '<h4 class="title">愤怒的葡萄</h4>'
pattern = '<h4 class="title">(.*?)</h4>'
# pattern = '.*?s'
s = re.compile(pattern).findall(string)
print(s)

原文地址:https://www.cnblogs.com/komean/p/11079347.html