Answer the question
In order to leave comments, you need to log in
How to save numbers from website to excel?
Hello. There was such a task. There are several matches going on and you need to save W1 odds every 10 seconds in Excel until the matches are over. In the first column there will be the name, in the following coefficients. Please tell me how to implement
from selenium import webdriver
import time
driver = webdriver.Chrome()
driver.get("https://zenitbet.com/live/view2/#!/sport134")
time.sleep(5)
a=[]
koef = driver.find_elements_by_xpath("//td[@class='cf'][1]")
for i in koef:
h=i.find_element_by_xpath("..//b[@class='g-d g-d-s']")
my_file = open('zenit.xls', 'a')
my_file.write(h.text + i.text)
Answer the question
In order to leave comments, you need to log in
To write to an excel file, you need to use third-party modules, like XlsxWriter
import xlsxwriter
workbook = xlsxwriter.Workbook('hello.xlsx')
worksheet = workbook.add_worksheet()
worksheet.write('A1', 'Hello world')
workbook.close()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question