问题描述
这是我目前拥有的.有没有更好的方法来做到这一点?
this is what i have, currently. is there any nicer way to do this?
import struct def int32_to_uint32(i): return struct.unpack_from("i", struct.pack("i", i))[0]
推荐答案
不确定是不是更好"...
not sure if it's "nicer" or not...
import ctypes def int32_to_uint32(i): return ctypes.c_uint32(i).value