任何人都可以解释这个Python代码:
print "bits_received:", bits_received
tmp = 0
print type(tmp)
tmp = (1 << bits_received)
print type(tmp)
print "tmp: 0x{:X}".format(tmp)
可以产生这样的结果:
bits_received: 95
<type 'int'>
<type 'numpy.int64'>
tmp: 0x80000000
答案 0 :(得分:1)
user2357112是正确的:
bits_received: 88 <type 'int'>
bits_received: 95 <type 'numpy.int64'>
bits_received 变量的类型已从 int 更改为 numpy.int64 ,通过添加另一个类型 numpy的变量.int64 。将其他变量包装在&#34; int(...)&#34;解决了我的问题。
谢谢,user2357112!