Skip to content

Instantly share code, notes, and snippets.

@shashankvemuri
Created May 25, 2020 03:18
Show Gist options
  • Save shashankvemuri/f563bce0d22bc1678d18b6736fd020ac to your computer and use it in GitHub Desktop.
Save shashankvemuri/f563bce0d22bc1678d18b6736fd020ac to your computer and use it in GitHub Desktop.
iterate through the news
# Iterate through the news
parsed_news = []
for file_name, news_table in news_tables.items():
for x in news_table.findAll('tr'):
text = x.a.get_text()
date_scrape = x.td.text.split()
if len(date_scrape) == 1:
time = date_scrape[0]
else:
date = date_scrape[0]
time = date_scrape[1]
ticker = file_name.split('_')[0]
parsed_news.append([ticker, date, time, text])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment