gpt4 book ai didi

python - 如何在 python 中将 ctypes.c_uint32 转换为 int?

转载 作者:行者123 更新时间:2023-11-28 21:19:20 25 4
gpt4 key购买 nike

我在一个结构中获取一些值,该结构的成员类型为 ctypes.c_uint32,当我尝试打印此值时,它会打印该变量的特征,如类型、偏移量、大小.我需要在 python 程序中使用该值,那么如何将其转换为 int。?

最佳答案

Those objectsvalue attribute :

In [14]: ct = ctypes.c_uint32(42)

In [15]: type(ct)
Out[15]: ctypes.c_uint

In [16]: ct.value
Out[16]: 42

In [17]: type(ct.value) is int
Out[17]: True

关于python - 如何在 python 中将 ctypes.c_uint32 转换为 int?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24802847/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com