我可以在我的浏览器中打开网址:http ://www.bloomberg.com/markets/chart/data/1M/AAPL: AR,但我的代码在这里得到了结果I/O error(socket error):[Errno 11004] getaddrinfo failed
::
import urllib
import json
url='http://www.bloomberg.com/markets/chart/data/1M/AAPL:AR'
try:
html_file=urllib.urlopen(url)
html_text=html_file.read()
data=json.load(html_text)
data_points=data['data_values']
for i in range(len(data_points)):
print data_points[i]
except IOError as (errno,strerror):
print "I/O error({0}):{1}".format(errno,strerror)