我的代码:如何解决TypeError:'str'不支持缓冲区接口?
big_int = 536870912
f = open('sample.txt', 'wb')
for item in range(0, 10):
y = bytearray.fromhex('{:0192x}'.format(big_int))
f.write("%s" %y)
f.close()
我想一个长整型转换为字节。但我得到TypeError: 'str' does not support the buffer interface
。
只是尝试'f.write(y)' –
谢谢,它的工作原理 – rrra