inflearn logo
Khóa học

Khóa học

Chia sẻ kiến thức

Bài viết của teddy2023

teddy2023 teddy2023

@teddy2023

Số lượng đánh giá đã viết
1
Xếp hạng trung bình
5.0

Bài viết 2

Hỏi & Đáp

어제 강의 이어서 질문드립니다

import requests from bs4 import BeautifulSoup res = requests.get(' https://v.daum.net/v/20170615203441266 ') soup = BeautifulSoup(res.content, 'html.parser') items = soup.select (' div.news _view.fs_type1 > div.article_view > section > p:nth-child(1)') for item in items: print (item.get_text()) items = soup.select (' div.news _view.fs_type1 > div.article_view > section > p:nth-child(2)') for item in items: print (item.get_text()) items = soup.select (' div.news _view.fs_type1 > div.article_view > section > p:nth-child(3)') for item in items: print (item.get_text()) items = soup.select (' div.news _view.fs_type1 > div.article_view > section > p:nth-child(4)') for item in items: print (item.get_text()) 다다음 강의에 css selector로 해보다가 비슷하게 방법을 찾았어요 1-4 까지 반복되는걸 좀 편하게 바꾸고 싶은데 아직 공부가 부족한지 자꾸 오류가 나네요 ㅠㅠ 앞으로는 모르는 내용있으면 다음 강의를 좀 들어볼게요 ㅎㅎ 감사합니다

Lượt thích
0
Số bình luận
2
Lượt xem
582

Hỏi & Đáp

패턴으로 실습하며 익히기:html/css 이해를 바탕으로 크롤링하기

import requests from bs4 import BeautifulSoup res = requests.get(' https://v.daum.net/v/20170615203441266 ') soup = BeautifulSoup(res.content, 'html.parser') items = soup.select (' div.news _view.fs_type1 > div.article_view > section > p:nth-child(1)') for item in items: print (item.get_text()) items = soup.select (' div.news _view.fs_type1 > div.article_view > section > p:nth-child(2)') for item in items: print (item.get_text()) items = soup.select (' div.news _view.fs_type1 > div.article_view > section > p:nth-child(3)') for item in items: print (item.get_text()) items = soup.select (' div.news _view.fs_type1 > div.article_view > section > p:nth-child(4)') for item in items: print (item.get_text()) 다다음 강의에 css selector로 해보다가가 비슷하게 방법을 찾았어요 1-4 까지 반복되는걸 좀 편하게 바꾸고 싶은데 아직 공부가 부족한지 자꾸 오류가 나네요 ㅠㅠ 앞으로는 모르는 내용있으면 다음 강의를 좀 들어볼게요 ㅎㅎ 감사합니다

Lượt thích
0
Số bình luận
2
Lượt xem
610