python - Python 中用于从 Web 中提取信息的解析器

标签 python html html-parsing

我的任务是解析 HTML 页面(西里尔文)并提取某些单词。这是我必须解析的网页:http://www.toponymic-dictionary.in.ua/ 。我只得到了页面:

import urllib
from lxml.html import fromstring
url = 'http://www.toponymic-dictionary.in.ua/'
content = urllib.urlopen(url).read()
doc = fromstring(content)
doc.make_links_absolute(url)

HTML代码对我来说相当复杂(使用xpath),所以我不知道如何继续解析。

最佳答案

看看这个库:BeautifulSoup

以及它的Documentation

它最适合您的要求。

干杯!

关于python - Python 中用于从 Web 中提取信息的解析器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15806187/

相关文章:

ios - 在 Objective-C 中解析 HTML

python - 如何组合所有 3 合 1 re.findall() ??(python 2.7 && 正则表达式)

python - "Map"Python 中的嵌套列表

python - 让 TortoiseHg 使用单独的 Mercurial 包

javascript - Docker 本地 js 文件 IO 错误

error-handling - Scrape Offer 不返回任何结果

python - 重新排列数组以在 Python 中按顺序排列

html - 在哪里可以找到 HOCR 文件的样本?

javascript - 使用 RegEx 分解 html 源代码

javascript - 如何在angularJS中刷新cookie