#!/usr/bin/python

#Tyler Moore
#Solution to Example 1, Python notes
#2 Feb 2012

import urllib2
state2PeaceYrs={}
for line in urllib2.urlopen("http://cs.wellesley.edu/~qtw/data/peaceIndexNoHeader.csv"):
    if line=='\n': continue
    bits=line.split(',')
    state2PeaceYrs[bits[0]]=[float(b) for b in bits[1:]]

#OK let's debug to make sure this makes sense
len(state2PeaceYrs)  #should be 50
[len(state2PeaceYrs[s]) for s in state2PeaceYrs] # should be a 50-element list, all of length 19
