Text Scraping (from Edgar 10k Amazon) Code Not Working
I have the below code to scrape some specific word list from the financial statements (US SEC EDGAR 10K) text file. Will highly appreciate if you anyone can help me with this. I ha
Solution 1:
A simplified version of your code seems to work in Python 3.7 with the requests library:
import requests
url = 'https://www.sec.gov/Archives/edgar/data/1018724/0001193125-13-028520.txt'
response = requests.get(url)
words = [your word list above ]
count = {} # is a dictionary data structure in Python
for elem in words:
count[elem] = 0
info = str(response.content)
count[elem] = count[elem] + info.count(elem)
print(count)
Output:
{'anticipate': 9, 'believe': 32, 'depend': 39, 'fluctuate': 4, 'indefinite': 15, 'likelihood': 15, 'possible': 25,
'predict': 6, 'risk': 55, 'uncertain': 38}
Post a Comment for "Text Scraping (from Edgar 10k Amazon) Code Not Working"