MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   什么是MATLAB结构数组的Python版本 (https://www.labfans.com/bbs/showthread.php?t=26245)

poster 2019-12-14 20:13

什么是MATLAB结构数组的Python版本
 
我是Python的新手。我想将SQL查询的结果放在某种矩阵变量中,例如[URL="http://www.mathworks.com/help/techdoc/ref/struct.html"]MATLAB[/URL]的[URL="http://www.mathworks.com/help/techdoc/ref/struct.html"]结构数组[/URL] 。基本上是一个包含数字和字符串的矩阵。

然后,变量保存查询的行和列。
我怎样才能做到这一点?

谢谢。



[B]回答:[/B]

如果@Matti的答案不是您想要的,也许词典列表会做到这一点?

select field1, field2, field3 from SomeTable 然后将其转换为:

[{'field1' : 1, 'field2' : 'asdf', 'field3' : 3.234}, {'field1' : 0, 'field2' : 'Some string here', 'field3', 0.93284},]

[url=https://stackoverflow.com/questions/4844377]更多&回答...[/url]


所有时间均为北京时间。现在的时间是 23:24

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.