
영상을 따라서 하다가 궁금한 점이 생겨서 질문 드립니다.
soup.select () 는 이해가 되는데요 .. 그 다음 진행에서 왜 tr.select_one 이 되는건가요 ?
저는 당연히 soup.select_one 인 줄 알고 그렇게 먼저 했습니다.
import requests
from bs4 import BeautifulSoup
headers = {'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36'}
data = requests.get('https://movie.naver.com/movie/sdb/rank/rmovie.naver?sel=pnt&date=20210829',headers=headers)
soup = BeautifulSoup(data.text, 'html.parser')
#old_content > table > tbody > tr:nth-child(2) > td.title > div > a
#old_content > table > tbody > tr:nth-child(3) > td.title > div > a
trs = soup.select('#old_content > table > tbody > tr')
for tr in trs :
# a = soup.select_one ('')
a = tr.select_one('') 강사님께서 tr 을 쓰시네요 ??
