Guest User

18-10-16

a guest
Oct 18th, 2016
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. import bs4
  2. import requests
  3.  
  4. url = 'https://sinoptik.ua/'
  5. list_day_link = []
  6. list_date = []
  7. list_month = []
  8. list_min_temp = []
  9. list_max_temp = []
  10. total_list = []
  11.  
  12. def html_get(html):
  13. req = requests.get(html)
  14. return req.text
  15.  
  16. soup = bs4.BeautifulSoup(html_get(url),"html.parser")
  17. day_link = soup.find_all(class_="day-link")
  18. date = soup.find_all(class_="date dateFree")
  19. date1 = soup.find_all(class_="date ")
  20. month = soup.find_all(class_="month")
  21. min_temp = soup.find_all(class_="min")
  22. max_temp = soup.find_all(class_="max")
  23.  
  24. list_day_link = [x.get_text() for x inday_link]
  25. list_date = [x.get_text() for x in date]
  26. list_month = [x.get_text() for x in month]
  27. list_min_temp = [x.get_text() for x inmin_temp]
  28. list_max_temp = [x.get_text() for x inmax_temp]
  29. list_date = [x.get_text() for x in date1]
  30.  
  31. list1 = list_day_link + list_date
  32. list1[::2] = list_day_link
  33. list1[1::2] = list_date
  34. print(list1,'\n',list_month,'\n',list_min_temp,'\n',list_max_temp)
Advertisement
Add Comment
Please, Sign In to add comment