# Script to read greeting from the web. from urllib.request import urlopen # Define url of webpage to read url = "http://facweb.cdm.depaul.edu/sjost/it212/rates.txt" # Open input stream input_stream = urlopen(url) # Initialize dictionary d = dict( ) for line in input_stream: decoded_chars = line.decode("utf-8-sig").strip( ) fields = decoded_chars.split(",") code = fields[0] rate = float(fields[1]) d[code] = rate input_stream.close( ) print(d)