[Python] 웹크롤링 - 태그를 이용해서 크롤링하기 - (2) 사전구축
·
python/자동화
이전 코드에서 나아가 한국민족대백과사전의 사전을 크롤링을 통해 만들어보겠습니다. from bs4 import BeautifulSoup import urllib.request as req import argparse # 특정 웹사이트로 접속하기 위해 import re def crawling_list(url): res = req.urlopen(url).read() soup = BeautifulSoup(res, 'html.parser') #분석 용이하게 파싱 find_tag = soup.findAll("a",{"class":"depth1-title"}) # "div",{"class":"section_body"} korean_hist = dict() for i in range(len(find_tag)): txt..