按行解析HTML [英] Parse HTML by line

查看:84
本文介绍了按行解析HTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Python和Beautiful Soup解析HTML网页(不过,我可以接受其他解决方案).我想知道是否可以基于HTML一行(get the td tag from line3)来解析文件.这可能吗?

I am parsing an HTML webpage with Python and Beautiful Soup (I am open to other solutions, though). I am wondering if it is possible to parse the file based on a line of HTML, i.e., get the td tag from line3. Is this possible?

推荐答案

请考虑以下示例:http://www.pythonforbeginners.com/python-on-the-web/web-scraping-with-beautifulsoup/逐行处理和匹配href(您需要td)

consider this example: http://www.pythonforbeginners.com/python-on-the-web/web-scraping-with-beautifulsoup/ there is line-by-line processing and matching of href(you need td)

另外考虑:soup.find_all("td", limit=3)

这篇关于按行解析HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆