beautifulsoup get image alt code example
Example: beautifulsoup get img alt
# 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)]))
# 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)]))