如何从多个html中解析电话号码?

How to parse phone numbers from multiple html's?

提问人:2manov 提问时间:2/5/2019 更新时间:2/5/2019 访问量:107

问:

我不知道如何解析来自多个 html 的电话号码,因为它们在 span 类中具有不同的名称。我只有一个想法,那就是解析完整的html文本并使用正则表达式获取电话号码,但是我有大约1000个html,我认为它会花费很多时间

我知道如何使用 BeautifulSoup 解析单个 html 页面

r = requests.get(Base_URL)
soup = BeautifulSoup(r.content)
print soup.find("div", class_="some_class").find("span", class_="phone number").text
python-2.7 html解析

评论

0赞 Eric Duminil 2/5/2019
如果您不知道电话号码的位置,正则表达式可能是最好的解决方案。解析 1000 个 html 应该不会花很长时间
0赞 Alderven 2/5/2019
给我们几个html例子
0赞 2manov 2/5/2019
@Alderven链接

答: 暂无答案