基于Python的Web信息抽取解析器

2024-09-30 20:18:08 发布

您现在位置:Python中文网/ 问答频道 /正文

我的任务是解析一个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),所以我不知道如何进行解析。在


Tags: inimporthttpurldocdictionaryhtmlwww