I'm just learning about python & web scraping, I'm trying to scrape sectional times from attheraces & I can get the data into a spreadsheet but it is all vertical & I want to get it as a horizontal table (like dispalyed on the website), so far I have this...
from urllib.request import urlopen as uReq
from bs4 import BeautifulSoup as soup
my_url = "http://www.attheraces.com/ajax/getContent.aspx?ctype=sectionalsracecardresult&raceid=1062194&page=/racecard/Windsor/8-October-2018/1325&dtype=times"
uClient = uReq (my_url)
page_html =uClient.read()
uClient.close()
page_soup=soup(page_html, "html.parser")
containers = page_soup.findAll ("div",{"class":"card-body__td card-body__td--centred card-cell__time card-cell__time--8-sectionals"})
filename = "sectionals.csv"
f= open (filename, "w")
headers = "sectional\n"
f.write(headers)
for container in containers:
sectional = container.div.div.span.text
print(sectional)
f.write(sectional + "," + "\n")
f.close()