Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
一个 64 位的数字被msgpack解包为带符号的;我怎样才能将它重新解释为未签名?
怎么样
if x < 0: x += 2 ** 64
或者,如果你更喜欢玩弄,
x &= 2 ** 64 - 1
你的意思是这样的?
>>> struct.unpack('L', struct.pack('l', -2235234523)) (18446744071474317093L,)