re.DOTALL标志告诉python做'。' 特殊字符匹配所有字符,包括换行符。
import re paragraph = \ ''' This is a paragraph. It has multiple lines. ''' match = re.search(r'<p>.*</p>', paragraph, re.DOTALL) print match.group(0)
输出结果
This is a paragraph. It has multiple lines.
友情链接: json在线解析 通晓查询 糯晒黄历 姓名打分