Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- from bs4 import BeautifulSoup
- url = "https://yandex.ru/pogoda/"
- city = "moscow"
- response = requests.get(url + city)
- html = BeautifulSoup(response.content, "lxml")
- def temp():
- return html.find("span", {"class": "temp__value"}).text
- def wind_speed():
- return html.find("span", {"class": "wind-speed"}).text
- def pressure():
- return html.find("dl", {"class": "fact__pressure"}).dd.text
- def humidity():
- return html.find("dl", {"class": "fact__humidity"}).dd.text
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement