亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

Chinaunix

標(biāo)題: 有什么好的方法處理數(shù)據(jù)庫返回的查詢結(jié)果fetchall? [打印本頁]

作者: 古丁高手    時(shí)間: 2016-09-01 15:08
標(biāo)題: 有什么好的方法處理數(shù)據(jù)庫返回的查詢結(jié)果fetchall?

數(shù)據(jù)庫返回來的查詢是元組,如何格式化處理好?特別是日期方面


作者: Hadron74    時(shí)間: 2016-09-01 15:28
放在pandas里。
http://stackoverflow.com/questio ... ndas-data-structure
作者: ghostwwl    時(shí)間: 2016-09-02 12:58
本帖最后由 ghostwwl 于 2016-09-02 12:59 編輯

我以前好像是這么干的

get_fields = ('id', 'name', 'title');
sql  = 'select %s from aaa' % (','.join(get_fields)

結(jié)果:
r = []
for item in xxx:
    result = dict(zip(get_fields), item))
    r.append(result)
   
作者: 古丁高手    時(shí)間: 2016-09-02 15:50
我這樣干了,結(jié)果也是我想要的。 回復(fù) 3# ghostwwl







歡迎光臨 Chinaunix (http://72891.cn/) Powered by Discuz! X3.2