开发者

Python Beautiful soup tag for table td

开发者 https://www.devze.com 2023-01-08 14:29 出处:网络
Python Beautiful soup tag for table td <td class=\"result\" valign=\"top\" colsp开发者_开发问答an=\"3\">

Python Beautiful soup tag for table td

  <td class="result" valign="top" colsp开发者_开发问答an="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.

0

精彩评论

暂无评论...
验证码 换一张
取 消