问题
I have this following code it works 64bit another computer but it does not work with mine and gives the fallowing error.I use Python 3.3 and the requiered libraries. I could not solve the problem please help.
import matplotlib.pyplot as plt
import binascii
import numpy
import struct
array = []
out = open('output.txt','wb')
a=int(input("Enter the first value:"))
b=int(input("Enter the second value:"))
with open("thefile.bin", "rb") as f:
i=0
for i in range(0, a):
byte = f.read(1)
i=0
for i in range(a,b):
byte = f.read(1)
value = struct.unpack('B', byte)[0]
array.append(value)
plt.plot(array)
plt.ylabel('Value')
plt.show()
来源:https://stackoverflow.com/questions/17579444/struct-error-unpack-requires-a-string-argument-of-length-2