• 카테고리

    질문 & 답변
  • 세부 분야

    데이터 분석

  • 해결 여부

    미해결

과제 질문

21.07.06 21:38 작성 조회수 115

0

from bs4 import BeautifulSoup

import urllib.request as req

import urllib.parse as rep

import sys

import io

sys.stdout = io.TextIOWrapper(sys.stdout.detach(), encoding = 'utf-8')

sys.stderr = io.TextIOWrapper(sys.stderr.detach(), encoding = 'utf-8')

url = "https://www.daum.net/"

res = req.urlopen(url).read()

soup = BeautifulSoup(res, "html.parser")

top = soup.select("ul.list_inner")[0]

print(top)

#for i,e in enumerate(top,1):

    #print(i,e.select_one("h4.block_title > a").string)

분명히 웹사이트에는 내용이 있는데 출력해보면 빈리스트만 나오네요 왜이러는거죠?

답변 1

답변을 작성해보세요.

1

l.list_inner

이 부분 선택자가 잘 못된것 같습니다.

전체 내용 중에서 태그 내용을 한 번 자세히 살펴보시길 바래요.