I am trying to create the list which is in the one element. Thus i need to convert the one element into may: containing the dates.
Code:
import requests
from bs4 import BeautifulSoup
import ast
#gets the dates
URL = ("https://www.worldometers.info/coronavirus/country/us/")
page = requests.get(URL)
soup = BeautifulSoup(page.content, "html.parser")
results=soup.find_all("div", {"class": "col-md-12"})
data=results[4]
script = data.find('script')
string = script.string
datesTEMP = string.strip()[292:]#-9268]
x=datesTEMP
i=0
xaxis=[]
count=0
while count<1:
if x[i]=="]":
count=count+1
else:
xaxis.append(x[i])
i=i+1
xaxislength=len(xaxis)
xaxis = [''.join(xaxis[0:xaxislength])]
print(xaxis)