data_info = {'num':'200',#股票数目
'sort':'r3_net', #散户资金流入
'asc':'0',
'bankuai':'',
'shichang':''}
data = urllib.urlencode(data_info) #格式化数据
data = urllib2.urlopen(url = u"http://vip.stock.finance.sina.com.cn/quotes_service/api/json_v2.php/MoneyFlow.ssl_bkzj_ssggzj?page=1",
data = data)
data_in = data.read()[1:-2]
data_formt = data_in.split('},')
for respCmtJson in data_formt:
respCmtJson_1 = respCmtJson+'}'
respCmt = re.sub(r"(,?)(\w+?)\s*?:", r"\1'\2':",respCmtJson_1)
respCmt = respCmt.replace("'", "\"")
resp = respCmt.decode('iso-8859-2').encode('utf-8')
js = json.loads(resp)
Python 获取新浪财经数据的案例
最新推荐文章于 2024-08-01 09:56:19 发布