【发布时间】:2018-04-05 05:20:53
【问题描述】:
我正在尝试通过 python 的链接查找图像的数量(扩展名 .jpg、.png、jpeg)。我可以使用任何库,例如 beautifulsoup。但是我该怎么做。 我正在使用以下代码:
from bs4 import BeautifulSoup
soup = BeautifulSoup(open('HTMLS%5C110k_Source.htm'), "html.parser")
img_links = len(soup.find_all('.jpg'))
print("Number of Images : ", img_links)
但一切都是徒劳的。
【问题讨论】:
标签: python web-scraping beautifulsoup html-parsing