我在这里做错了什么?
它说:
TypeError: 'str' does not support the buffer interface.
这是我的代码:
with open('areas.txt','wb') as f:
f.write(b'CONTOUR VALUES x AREAS\n')
f.write(b'2\n')
for k in range(-40, 41, 1):
flag = 0.0
for i in range(NY):
for j in range(NX):
if values[i,j] > k:
flag = flag + 1.0
f.write(str(k)+' '+str( ((NX*NY) - flag ) * cell_area)+'\n')
plt.show()