MiP*_*MiP 1 python ctypes python-2.7
在Python 2,我可以重新定义的任何数量与所述ctypes模块,例如数2以3:
import ctypes
value = 2
ob_ival_offset = ctypes.sizeof(ctypes.c_size_t) + ctypes.sizeof(ctypes.c_voidp)
ob_ival = ctypes.c_int.from_address(id(value)+ob_ival_offset)
ob_ival.value = 3
print 1+1
Run Code Online (Sandbox Code Playgroud)
我应该什么时候需要这样做?