Created
July 6, 2014 21:55
-
-
Save bsmithgall/efe6efe5113af126c6d4 to your computer and use it in GitHub Desktop.
Value of a 2014 Dollar over Time
This file contains hidden or 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
import requests | |
from bs4 import BeautifulSoup | |
URL = "http://data.bls.gov/cgi-bin/cpicalc.pl?cost1=1.00&year1={year}&year2=2014" | |
# input a range of years here. The first valid year is 1913. | |
year_range = xrange(1939, 2014) | |
print [BeautifulSoup(requests.get(URL.format(year=i)).text).find('span', {'id': 'answer'}).text for i in year_range] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment