frombs4importBeautifulSoupimportpandasaspd#open downloaded html, adjust encodingwithopen("webpage.html",encoding='utf-8')asfp:soup=BeautifulSoup(fp,features="html.parser")#create empty lists for desired datanames=[]addresses=[]latitude=[]longitude=[]#loop through document#fist argument in find_all is the name of element, then attributes#for each card, get desired data and push into relateed listfordivinsoup.find_all("div",class_="card-component place-card"):names.append(div.get('data-name'))addresses.append(div.get('data-address'))latitude.append(div.get('data-latitude'))longitude.append(div.get('data-longitude')#create panda dataframe based on python lists, then translate into csvdf=pd.DataFrame({'Pharmacies':names,'Location':addresses,'Latitude':latitude,'Longitude':longitude})df.to_csv('filename.csv',index=False,encoding='latin-1')