인프런 영문 브랜드 로고
인프런 영문 브랜드 로고

Inflearn Community Q&A

blackcoding911's profile image
blackcoding911

asked

Introduction to Python and Creating Various Automated Applications Using Web Crawling

How to use BeautifulSoup and simple web parsing practice (1) - Naver, Daum, Inflearn

과제 질문

Written on

·

228

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)

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

python웹-크롤링

Answer 1

1

niceman님의 프로필 이미지
niceman
Instructor

l.list_inner

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

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

blackcoding911's profile image
blackcoding911

asked

Ask a question