Trying to get the link address of href, the attribute of tack a, in the Html statement.
The following error continues to appear in the code I made.
b = b.a['href']
TypeError: 'NoneType' object is not subscriptable
What's wrong?
The code is shown below.
browser.get("http://www.albamon.co.kr/")
alba = BeautifulSoup(browser.page_source, 'html.parser')
brands = alba.find(id = "MainSuperBrand").find_all("li")
for b in brands :
b = b.a['href']
print(b)
You have to bring the tag a.
brands = alba.find(id ='MainSuperBrand').find_all('a')
for b in brands :
print(b['href'])
© 2024 OneMinuteCode. All rights reserved.