Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. elif 'drom.ru' in vin[4]:
  2. code = driver.page_source
  3. soup = BeautifulSoup(code, 'html.parser')
  4. prices = soup.find_all('div', class_='b-advItem__section b-advItem__section_type_price')
  5. print(vin[4])
  6. try:
  7. prices_sum = list(map(lambda x: int(re.sub('\D', '', x.div.text)), prices))
  8. except:
  9. prices_sum = []
  10. if len(prices_sum) != 0:
  11. print(sum(prices_sum)//len(prices_sum))
  12. # with vertica_python.connect(**conn_info) as connection:
  13. # cur = connection.cursor()
  14. # cur.execute("update vins set price = {pr} where vin = '{vin}';commit;".format(pr = sum(prices_sum)//len(prices_sum), vin=vin[0]))
  15. # vins = cur.fetchall()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement