TypeError: 'list' does not support the buffer interface
尝试运行以下命令时出现错误:
file = open(filename + ".bmp", "rb")
data = file.read()
file.close()
new = []
for byte in data:
byte = int(byte)
if byte%2:#make even numbers odd
byte -= 1
new.append(bin(byte))
file = open(filename + ".bmp", "wb")
file.write(new)
file.close()
为什么会这样?我认为这是由于我正在写入的数据类型,.bmp
但我不确定我做错了什么。