from collections import deque
recvBuffer = deque()
x1 = b'\xFF'
recvBuffer.append(x1)
recvBuffer.extend(x1)
x2 = recvBuffer.pop()
x3 = recvBuffer.pop()
print(type(x1))
print(type(x2))
print(type(x3))
上面的代码打印以下内容Python 3.2.3
<class 'bytes'>
<class 'int'>
<class 'bytes'>
为什么将extend()-ed 变为双端队列时字节变为int?