-
카테고리
-
세부 분야
풀스택
-
해결 여부
미해결
AttributeError: 'NoneType' object has no attribute 'text'오류가 뜹니다.
21.02.24 00:21 작성 조회수 8.83k
0
1강 13:40초경입니다. 맨밑에처럼 코드를 작성하였는데 print(title)하고 실행 시 아래와 같은 오류가 뜹니다.
오류 뜬 cmd창과 해당 뽐뿌 스크린샷입니다.
모짜렐라 치즈가래떡 다음 상품이 품절상태이고, class=list_title없이 그냥 font태그에 담겨있는것같습니다..
혹시 이런경우에 어떻게 하면 될까요??
질문에 정보가 부족하다면 알려주시길바랍니다.
위와같은 오류가 납니다..
아래는 오류 났을 때 뽐뿌 사이트 입니다!
from bs4 import BeautifulSoup
import requests
response = requests.get("http://www.ppomppu.co.kr/zboard/zboard.php?id=ppomppu") # 사이트 불러오기
soup = BeautifulSoup(response.text,"html.parser")
for item in soup.find_all("tr",{'class' : ['list1','list0']}):
image = item.find("img",class_='thumb_border').get('src')[2:]
title = item.find("font", class_='list_title').text
print(title)
답변을 작성해보세요.
답변 1