Reputation: 43
This generates a result set as a list
#Dates
from bs4 import BeautifulSoup as bs
import pandas as pd
pd.set_option('display.max_colwidth', 500)
import requests
myURL = "xxxxx"
page = requests.get(myURL)
#print (page)
soup = bs(page.content,"html.parser")
#print(soup.prettify)
rSet = soup.find_all("td", class_="first")
for el in rSet :
print (el.find("first")) <-- returns "None"
print (el) <-- returns <td class="first" rowspan="1">00:00 - 01:00</td> (for eaxmple)
With elements that look like this:
<td class="first" rowspan="1">00:00 - 01:00</td>
<td class="first" rowspan="1">01:00 - 02:00</td>
I Want to extract "00:00" and "01:00" (- which are Start and End Times) and populate the Dataframe in two columns. What would be the best way to achieve this?
Upvotes: 0
Views: 30