HTML snippet :
<span class="photo_tooltip" id="__w2_YFXobXt_link">
<a href="/profile/Smit-Soni-2" id="__w2_GDetCwt_link">
<img class="profile_photo_img" src="https://assets.ec.quoracdn.net/-images.placeholder_img.png96cbdb37c749e493.png" height="50" width="50" data-src="https://assets.ec.quoracdn.net/main-thumb-18048885-50-ujrumofdevpkaarfisuvjdtbihztxnta.jpeg" alt="Smit Soni" />
</a></span>
I want to extract all the alt text and data-src from the img class="profile_photo_img. My code:
ele = soup.find_all('img', class_='profile_photo_img')
for i in ele:
print i["data-src"]
print i["alt"]
But it is printing nothing. How can I get the desired result?
soup