You need to import the full module:
import urllib.request
If you don't, the parent package will not have the submodule as an attribute.
You probably don't want to use urllib.request.urlretrieve()
here; you'd normally process the response directly in Python. You can also make use of the csv
module to read the data without needing to split:
from urllib.request import urlopen
import io
import csv
url = 'http://ichart.finance.yahoo.com/table.csv?s=xom&a=00&b=2&c=1999&d=01&e=12&f=2014&g=m&ignore=.csv'
reader_input = io.TextIOWrapper(urlopen(url), encoding='utf8', newline='')
reader = csv.reader(reader_input)
next(reader, None) # skip headers
cols = list(zip(*reader))
datelist, pricelist = cols[0], cols[4]