📜  beautifulsoup get img alt - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:10.679000             🧑  作者: Mango

代码示例1
# html_doc can read from file or url 
soup = BeautifulSoup(html_doc, features='lxml')
print("\n".join([img['alt'] for img in soup.find_all('img', alt=True)]))