V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  pc10201  ›  全部回复第 19 页 / 共 19 页
回复总数  364
1 ... 10  11  12  13  14  15  16  17  18  19  
2013 年 12 月 21 日
回复了 pc10201 创建的主题 Python 如何用json来分割
@Jowei 也不行
2013 年 12 月 20 日
回复了 pc10201 创建的主题 Python 如何用json来分割
@justfly

#coding=utf-8
import json
import requests


r=requests.get('http://vip.stock.finance.sina.com.cn/quotes_service/api/json_v2.php/Market_Center.getHQNodeData?page=1&num=10&sort=changepercent&asc=0&node=sz_a&symbol=')
print r.text
data_list=json.loads(r.text)
for data_item_dict in data_list:
print data_item_dict

不行啊,代码报错
Traceback (most recent call last):
File "D:/python_project/myself/���˹�Ʊ/test.py", line 8, in <module>
data_list=json.loads(r.text)
File "D:\Python27\lib\json\__init__.py", line 338, in loads
return _default_decoder.decode(s)
File "D:\Python27\lib\json\decoder.py", line 365, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "D:\Python27\lib\json\decoder.py", line 381, in raw_decode
obj, end = self.scan_once(s, idx)
ValueError: Expecting property name enclosed in double quotes: line 1 column 3 (char 2)
2013 年 12 月 10 日
回复了 pc10201 创建的主题 Python python bottle框架如何在windows下用static静态文件,如css,html等
我在程序目录中新建一个static目录,放入cs.txt文件
from bottle import static_file, route, run

@route('/')
def hello():
return 'test'

@route('/static/<filename>')
def server_static(filename):
return static_file(filename, root='./static')

run(host='localhost', port='8089')

已经弄好了,代码如上
2013 年 9 月 7 日
回复了 jasonchao 创建的主题 问与答 瘦子如何有效的增重?
人参归脾丸,补中益气丸~
1 ... 10  11  12  13  14  15  16  17  18  19  
关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   5206 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 25ms · UTC 08:38 · PVG 16:38 · LAX 01:38 · JFK 04:38
♥ Do have faith in what you're doing.