You need to check if titletext.a
is None
before you can use it for sure.
for titles in title:
titleheading = soup.findAll('h2')
for titletext in titleheading:
if titletext.a:
titlename = titletext.a
titlelink =titlename.get('href')
print(i)
print(titlelink)
i+=1
2
solved Non Type object has no attribute get error