我從urllib2獲得404。儘管鏈接在我的瀏覽器中正常工作...來自有效URL的Python 404 URLLIB2
import urllib2
import numpy
import scipy.stats
import csv
import httplib
f1 = urllib2.urlopen("http://ichart.finance.yahoo.com/table.csv?s=GOOG&a=01&b=1&c=2010&d=01&e=01&f=2011&g=d&ignore=.csv")
f2 = urllib2.urlopen("http://ichart.finance.yahoo.com/table.csv?s=APPL&a=01&b=1&c=2010&d=01&e=01&f=2011&g=d&ignore=.csv")
a = numpy.genfromtxt(f1, delimiter=',', skip_header=0, names=True);
b = numpy.genfromtxt(f2, delimiter=',', skip_header=0, names=True);
prs = scipy.stats.pearsonr(a['Open'], b['Open'])
print prs
F2 404對我的。 –