Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- import html2text
- import bs4
- s = requests.get ('https://sinoptik.com.ru/weather-kazan')
- main=bs4.BeautifulSoup(s.text, "html.parser")
- print ('---\nПогода на: ')
- x = main.select('.bd1 .day-link')
- x1 = x[0].getText().lower()
- print (x1)
- print ('---')
- print ()
- print ("Погода ночью:")
- p1 = main.select('.temperature .p1')
- pnight1 = p1[0].getText()
- p2 = main.select('.temperature .p2')
- pnight2 = p2[0].getText()
- print ('00:00 | ',pnight1)
- print ('03:00 | ',pnight2)
- print ()
- print ("Погода утром:")
- p3 = main.select('.temperature .p3')
- pmorning1 = p3[0].getText()
- p4 = main.select('.temperature .p4')
- pmorning2 = p4[0].getText()
- print ('06:00 | ',pmorning1)
- print ('09:00 | ',pmorning2)
- print ()
- print ("Погода днем:")
- p5 = main.select('.temperature .p5')
- pday1 = p5[0].getText()
- p6 = main.select('.temperature .p6')
- pday2 = p6[0].getText()
- print ('12:00 | ',pday1)
- print ('15:00 | ',pday2)
- print ()
- print ("Погода вечер:")
- p7 = main.select('.temperature .p7')
- pevening1 = p7[0].getText()
- p8 = main.select('.temperature .p8')
- pevening2 = p8[0].getText()
- print ('18:00 | ',pevening1)
- print ('21:00 | ',pevening2)
- print ()
- p = main.select('.rSide .description')
- desc = p[0].getText()
- print (desc)
- a = input()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement