I wanted to print a specific line from my HTML file. The specific line being the one enclosed as a header. My test.html file is posted at the bottom for reference
import codecs
import re
f = codecs.open("test.html", 'r')
f.read()
paragraphs = re.findall(r'<html>(.*?)</html>',str(f))
print(paragraphs)
f.close()
test.html looks like this
<html>
<head>
<title>
Example
</title>
</head>
<body>
<h1>Hello, world</h1>
</body>
</html>