Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import bs4
- import requests
- url = 'https://sinoptik.ua/'
- list_day_link = []
- list_date = []
- list_month = []
- list_min_temp = []
- list_max_temp = []
- total_list = []
- def html_get(html):
- req = requests.get(html)
- return req.text
- soup = bs4.BeautifulSoup(html_get(url),"html.parser")
- day_link = soup.find_all(class_="day-link")
- date = soup.find_all(class_="date dateFree")
- date1 = soup.find_all(class_="date ")
- month = soup.find_all(class_="month")
- min_temp = soup.find_all(class_="min")
- max_temp = soup.find_all(class_="max")
- list_day_link = [x.get_text() for x inday_link]
- list_date = [x.get_text() for x in date]
- list_month = [x.get_text() for x in month]
- list_min_temp = [x.get_text() for x inmin_temp]
- list_max_temp = [x.get_text() for x inmax_temp]
- list_date = [x.get_text() for x in date1]
- list1 = list_day_link + list_date
- list1[::2] = list_day_link
- list1[1::2] = list_date
- print(list1,'\n',list_month,'\n',list_min_temp,'\n',list_max_temp)
Advertisement
Add Comment
Please, Sign In to add comment