로딩
요청 처리 중입니다...

[파이썬으로 데이터 주무르기] 3장. 내가 몰랐던 코드모음 (1) - BeautifulSoup 이용하기

 [파이썬으로 데이터 주무르기] 3장. 내가 몰랐던 코드모음 (1) - BeautifulSoup 이용하기

1. 웹 데이터를 가져오는 BeautifulSoup 이용하기 (1) BeautfiulSoup import하기 from bs4 import BeautifulSoup (2) html 파일 가져오기 page = open('파일경로', 'r').read() soup = BeautifulSoup(page, 'html.parser') # 문서 전체를 저장함 print(soup.prettify()) #html 코드 전체 출력 print(soup.children) # 한단계 아래에서 포함된 태그를 알고 싶을 떄 [출력] 1-1 다른방법 import requests from bs4 import BeautifulSoup webpage = requests.get(url) soup = BeautifulSoup(webpage.content, 'html.parser') 2.

BeautifulSoup의 여러 가지 모듈 (1) html에 접근 html = list(soup.children)[2] #html에 접...

# beautifulsoup # 파이썬 # 태그 # 크롤링 # 분석 # 데이터 # next_sibling # html # get_text # children # body # 프로그래밍