![[파이썬]Beautifulsoup 이용 xml 파씽(기상청 육상 중기예보)](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FzoFAp%2FbtrUKXB3cji%2FZYJ4IQ0vNaEOkYUXKjyTvK%2Fimg.png)
from bs4 import BeautifulSoup import urllib.request as MyURL japi = 'http://www.kma.go.kr/weather/forecast/mid-term-rss3.jsp?stnId=109' response = MyURL.urlopen(japi) weather = BeautifulSoup(response, "html.parser") for location in weather.findAll('location'): print(location.city.string) print("="*20) for data in location.findAll('data'): print("시간:",data.tmef.string) print("날씨:",data.wf.string)..
![[파이썬]beautifulsoup를 이용한 사이트 정보 추출](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcWxbJk%2Fbtq3GEU6kuy%2FOiuOgNZxmRW4meCJPHcVyk%2Fimg.png)
1. beautifulsoup 설치 $ pip install beautifulsoup4 2. beautifulsoup 사용법 import requests from bs4 import BeautifulSoup url = 'https://darksharavim.tistory.com/' response = requests.get(url) if response.status_code == 200: html = response.text soup = BeautifulSoup(html, 'html.parser') print(soup) else: print(response.status_code) 상태값이 200인 경우만 출력 C:\Users\kajin7-ryzen3\PycharmProjects\darksharavim\v..