Stack Exchange
How to convert ctypes.c_uint32 to int in python?
I am getting some value inside a struct, whose member is of type ctypes.c_uint32, when I try to print this value, it rather prints the characteristics of that variable like type, offset, size. I need to use that value in python program so how to convert it to int.?

Those objects have the value 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


Probably unimportant, but in Python 2.7 ctypes.c_uint32(42).value is 42L (a long) and type(ctypes.c_uint32(42).value) emits <type 'long'>.

the value i am getting is of type _ctypes.CFeild, and when i try variable.value it gives error that _ctypes.CField has no attribute value, I am sure that value is ctypes.c_uint32.. so wanting to convert that into int
