목록Beautifulsoup (1)
JJUNNAK's

예제 코드 # URL 열어주는 라이브러리 from urllib.request import urlopen from bs4 import BeautifulSoup # url 지정 url = "https://www.ddaily.co.kr/news/article/?no=241974" # urlopen 함수로 경로를 따라가서 html 변수에 저장 html = urlopen(url) # bs_obj 변수에 url 페이지에 있는 html 저장 bs_obj = BeautifulSoup(html, "html.parser") # 태그로 감싸진 부분 추출 dl = bs_obj.find_all("dl") # 부분에 태그 부분만 추출 dd = dl[1].find_all("dd") # 추출된 dd 객체를 enumerate() 함수..
Crawling
2023. 1. 13. 04:12