I am using the Python HTMLParser module from html.parser . I am looking for one tag, and when it is found, it makes sense to stop parsing. Is it possible? I tried calling close() , but I'm not sure if this is the way to go.
class MyHTMLParser(HTMLParser): def handle_starttag(self, tag, attrs): login_form = False if tag == "form": print("finished") self.close()
However, this is similar to a recursive effect ending in
File "/usr/lib/python3.4/re.py", line 282, in _compile p, loc = _cache[type(pattern), pattern, flags] RuntimeError: maximum recursion depth exceeded in comparison
source share