[파이썬]Beautifulsoup 이용 xml 파씽(기상청 육상 중기예보)
# Script/Python2022. 12. 28. 12:59[파이썬]Beautifulsoup 이용 xml 파씽(기상청 육상 중기예보)

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를 이용한 사이트 정보  추출
# Script/Python2021. 4. 29. 11:12[파이썬]beautifulsoup를 이용한 사이트 정보 추출

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..

image