from html.parser import HTMLParser
from html.entities import name2codepoint
switch = 0
class MyHTMLParser(HTMLParser):
def handle_starttag(self, tag, attrs):
global switch
if attrs == [('class', 'list-recent-events menu')]:
switch = 1
def handle_endtag(self, tag):
if tag == 'ul':
if switch == 1:
def handle_data(self, data):
print(data)
Sign in to make a reply
A22B9S
from html.parser import HTMLParser
from html.entities import name2codepoint
switch = 0
class MyHTMLParser(HTMLParser):
def handle_starttag(self, tag, attrs):
global switch
if attrs == [('class', 'list-recent-events menu')]:
switch = 1
def handle_endtag(self, tag):
global switch
if tag == 'ul':
if switch == 1:
switch = 0
def handle_data(self, data):
global switch
if switch == 1:
print(data)