我想把一堆结果发送到服务器。你知道吗
cur.execute('SELECT a,b,c,b FROM wicap WHERE a.num > 600 limit 25')
r = cur.fetchall()
此时r为:
[(1487590224, 1487614532, -75, -41, 504, -73),
(1487596562, 1487614915, -75, -59, 156, -75),...]
我想做一些类似的事情:
response = urllib2.urlopen('http://example.com/post/', data=r)
在服务器端,您可以通过以下方式获取数据:
def POST()
data = web.data()
for record in data...
然后在服务器上处理查询结果。你知道吗
urlencode失败,出现ValueError:要解压缩的值太多 我试过用res=[dict]创建一个json((当前描述[i] [0],value)对于i,value in enumerate(row))对于r]中的行 但是f=urllib2.urlopen(\u url,res)返回TypeError:必须是string或buffer,而不是list
欢迎有想法!你知道吗
您需要使用
json.dumps
将数据编码为json:相关问题 更多 >
编程相关推荐