How to print the empty data present in a table from its HTML code?
问题 I am using the HTMLParser module present in python to print the data in a table by parsing the HTML page through the HTMLParser. I am unable to print the empty field in the table. Here is the code I'm using: class MyParser(HTMLParser): def __init__(self, data ): HTMLParser.__init__(self) self.feed(data) def handle_data(self, data): print "result -->", data m = MyParser("""<p>105</p><p></p>""") result --> 105 I am able to print the data between the first tag <p>105</p> . I want to print the