I want to display only the start of the html tags
<h1>test</h1>
<h2>test2</h2>
<div id="content"></div>
<p>test3</p>
<div id="nav"></div>
<p>test3</p>
if the above is given, i only want to display the tags that has html attributes
<div id="content">
<div id="nav">
I try to do that below but I get instead.
=“content”>
=“nav”>
import re
file = open('test.html')
test = file.read()
lines = test.splitlines()
b= re.findall(r'<?=.*?>',test)
for a in b:
print(a)
how to i fix my code so that i get
<div id="content">
<div id="nav">
instead of
="content">
="nav">