简体   繁体   English

Python:使用 ctypes 的多维数组?

[英]Python: Multi-Dimensional Array Using ctypes?

How do I define a multi-dimensional float array using ctypes in python ?如何在python中使用ctypes定义多维浮点数组?

Is there a limitation to the number of dimensions that can be defines?可以定义的维度数量是否有限制?

Here's one quick-and-dirty method:这是一种快速而肮脏的方法:

>>> A = ((ctypes.c_float * 10) * 10)
>>> a = A()
>>> a[5][5]
0.0

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM