You are viewing a single comment's thread. Return to all comments →
from html.parser import HTMLParser class MyHTMLParser(HTMLParser): def handle_comment(self, data): print('>>> Multi-line Comment', data, sep='\n') if '\n' in data else print('>>> Single-line Comment', data, sep='\n') def handle_data(self, data): if data != '\n': print('>>> Data', data, sep='\n') N_line = "" parser = MyHTMLParser() for i in range(int(input())): N_line += input().rstrip() + '\n' parser.feed(N_line) parser.close()
Seems like cookies are disabled on this browser, please enable them to open this website
HTML Parser - Part 2
You are viewing a single comment's thread. Return to all comments →