我有
class Temp(ctypes.Structure):
_fields_ = [('a', ctypes.c_longlong),
('b', ctypes.c_uint32)]
我希望得到b
的值(在python中它应该是int/long)。在
我尝试使用
^{pr2}$但我知道
<attribute 'value' of '_ctypes._SimpleCData' objects>
坦白地说,我不知道如何以整数/长格式访问此值。 这个结构是由C++程序填充的,我如何访问它?在
首先,您应该实例化
Temp
类型的对象,然后可以使用内置的getattr
:_fields_
只包含字段名和数据类型。在相关问题 更多 >
编程相关推荐