79276881

Date: 2024-12-12 23:43:17
Score: 1
Natty:
Report link

Using html.parser:

class MyHTMLParser(HTMLParser):
    def handle_data(self, data: str):
        line, col = self.getpos()
        previous_lines = ''.join(html_string.splitlines(True)[:line - 1])
        index = len(previous_lines) + col
        print(data, 'at', index)
parser = MyHTMLParser()
parser.feed(html_string)
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Nils