I need help in looping a list and extracting the src
links. This is my list and the code:
getimages = getDetails.find_all('img')
#deleting the first image in the list
getimages[0].decompose()
print(getimages)
The output of getimages list is :
[<None></None>]
[<None></None>, <img border="0" data-original-height="855" data-original-width="1885" src="https://1.bp.blogspot.com/-mq2ilVOcyPQ/X70khVD9UaI/AAAAAAAArLw/xC2LggPdcRUTm3aTGpPFYhoM6rDJwbyzACLcBGAsYHQ/s16000-rw/ssc-admit-card.webp"/>]
[<None></None>]
This is how I am looping to extract the src
image :
try:
for x in getimages:
print (x['src'])
except :
print("Image not found")
The output is always Image Not found
, but the image is present in the list, How can i fix it, please guide. Thanks
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…