bobsr
bobsr

Reputation: 3955

Python Beautiful soup tag for table td

Python Beautiful soup tag for table td

  <td class="result" valign="top" colspan="3">

At the moment, the following does not work:

for header in soup('table', 'td .result'):

Getting error:

HTMLParser.HTMLParseError: malformed start tag

Upvotes: 1

Views: 518

Answers (1)

Cerin
Cerin

Reputation: 64729

As noted on their website, HTMLParser is quite fragile. You should use SGMLParser instead, as it's more robust against malformed HTML.

Unfortunately, Python 3.0 has removed SGMLParser from the standard library. See the links above for suggested workarounds, such as using html5lib.

Upvotes: 1

Related Questions