regex negation - How to exclude certain characters from Html tags when webscraping data using python -
i trying webscrape data learn, problem when use find_all('td') cell value, 1 of cell value % sign ,this messes format , puts in different line (when convert later table output), how exclude % sign ? using python 2.7
r = requests.get("http://www.tradingeconomics.com/united-states/indicators") soup = beautifulsoup(r.content) ecodatasaved = "" record in soup.find_all('tr'): ecodata = "" data in record.find_all('td'): ##this % sign comes s = data.text ecodata = ecodata + "," + s.strip() ecodatasaved = ecodatasaved + "\n" + ecodata[1:]
Comments
Post a Comment