简体   繁体   中英

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

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM