Python 获取新浪财经数据的案例
2015-10-12 18:22
633 查看
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 tkinter调整元件在窗口中的位置与几何布局管理
- Python语法快速入门指南
- 初步认识Python中的列表与位运算符
- Python入门学习之字符串与比较运算符
- Python核心编程第二章习题
- Python.turtle
- python爬虫
- 排序算法总结以及python代码实现
- python发送邮件
- python学习:编码中遇到的问题原因及解决方案
- python 局部local和全局global变量
- python 异常处理
- Python常用转换函数
- python pip源配置
- python实现查找指定文件
- python 调用系统命令
- python之我对装饰器的理解
- python udp编程实例
- python ,end=''备注
- wxpython的binder问题