You are viewing a single comment's thread. Return to all comments →
My version :
from html.parser import HTMLParser import sys class MyHTMLParser(HTMLParser): def handle_comment(self, comment): if '\n' in comment: print('>>> Multi-line Comment', comment, sep='\n') else: print('>>> Single-line Comment', comment, sep='\n') def handle_data(self, data): if not data == '\n': print('>>> Data', data, sep='\n') html_chunk = sys.stdin.read()[1:].strip() parser = MyHTMLParser() parser.feed(html_chunk) parser.close()
Seems like cookies are disabled on this browser, please enable them to open this website
I agree to HackerRank's Terms of Service and Privacy Policy.
HTML Parser - Part 2
You are viewing a single comment's thread. Return to all comments →
My version :