Skip to content

Commit

Permalink
Regex and Parsing!
Browse files Browse the repository at this point in the history
  • Loading branch information
snehalmastud authored Feb 23, 2020
1 parent 49eba96 commit 02ee520
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from HTMLParser import HTMLParser

class MyHTMLParser(HTMLParser):
def handle_starttag(self, tag, attrs):
print tag
for attr, value in attrs:
print "->", attr, ">", value

def handle_startendtag(self, tag, attrs):
print tag
for attr, value in attrs:
print "->", attr, ">", value

html = ''
for _ in range(int(raw_input())):
html += raw_input().rstrip() + '\n'

parser = MyHTMLParser()
parser.feed(html)
parser.close()

0 comments on commit 02ee520

Please sign in to comment.