반응형 전체 글461 [디시인사이드] 김소혜 게시판 댓글 웹 크롤링 from bs4 import BeautifulSoupimport urllib.request if __name__ == "__main__": req = urllib.request.Request("http://gall.dcinside.com/board/lists/?id=kimsohye");data = urllib.request.urlopen(req).read()bs = BeautifulSoup(data, 'html.parser')l = bs.find_all('a')idx = 0 for s in l : try : prop = s.get('class')# get class propertyif prop != None and prop[0] == "icon_pic_n": a = "%s : %s" % (s.get('h.. 2017. 1. 6. [디시인사이드] 김소혜 게시판 크롤링 from bs4 import BeautifulSoupimport urllib.request if __name__ == "__main__": req = urllib.request.Request("http://gall.dcinside.com/board/lists/?id=kimsohye");data = urllib.request.urlopen(req).read()bs = BeautifulSoup(data, 'html.parser') l = bs.find_all('a')idx = 0 for s in l : try : prop = s.get('class')# get class propertyif prop != None and prop[0] == "icon_pic_n": print("%s : %s" % (s.get.. 2017. 1. 6. [파이썬3] 파이썬 인터프리터에서 테스트 파이썬버전: 3.6.xxxx뷰티풀수프 버전: 4.5.3.xxxxx툴: Sublime text3 #파이썬 인터프리터에서 웹크롤링 테스트 import urllib.requestfrom bs4 import BeautifulSoup html = urllib.request.urlopen('http://naver.com')soup = BeautifulSoup(html)print (soup.prettify()) 2017. 1. 6. [파이썬3] 파이썬 Beautiful Soup 4 설치하기 http://deadfile.tistory.com/entry/%EC%9C%88%EB%8F%84%EC%9A%B0%EC%97%90%EC%84%9C-BeautifulSoup4-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0 2017. 1. 6. 이전 1 ··· 111 112 113 114 115 116 다음 반응형