我有类似的查询:
c.execute('''select FileSize, FileName, FileType from ExampleTable
where FileType = ?''', [FileType])
bestCRThLocal = list(c.fetchall())
print(bestCRThLocal[0]);
我希望FileName,FileType和FileSize的数组各自拥有自己的数组。
在python中执行此操作的最佳方法是什么?
答案 0 :(得分:1)
使用zip()
。例如:
>>> l = [[1, 2, 3], [4, 5, 6],[7, 8, 9]]
>>> zip(*l)
[(1, 4, 7), (2, 5, 8), (3, 6, 9)]