I am looping through some pages scraping the text out of an a tag.
Everything runs smoothly, except one page, which doesn't have the a tag that I am scraping. I am hoping to be able to scrape the text I need from each pages's a tag, and have the script continue after this page that doesn't have the a tag.
I tried to get arround the issue by using an 'if else None' statement. But I have not been able to get that to work.
This leads to an Attribute Error: 'NoneType' object has no attribute 'a'
I have tried to get around this by using an 'if else none' statement, but have not been able to get that to work.
p = indaplaybox.div.a
P_O = p.text if p else None
print(P_O)
Thanks for the help!
Aucun commentaire:
Enregistrer un commentaire