Created
May 25, 2020 03:18
-
-
Save shashankvemuri/f563bce0d22bc1678d18b6736fd020ac to your computer and use it in GitHub Desktop.
iterate through the news
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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