測驗代碼:
tf = open('T.bin', 'wb')
tf.write(struct.pack('<HHHH', width, hight, format_, pixel_size))
tf.close()
代碼就這么簡單,struct.pack('<HHHH', 134, 38, 1, 4)列印沒問題,格式是b'\x86\x00\x26\x00\x01\x00\x04\x00'
但是bin檔案的資料只有c2 86 26 01 04
而不是預期的86 00 26 00 01 00 04 00
請問是什么原因?
uj5u.com熱心網友回復:
用其他編輯器看,對不上。直接讀貌似沒問題。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/34973.html
上一篇:Python中attributeerror錯誤如何解決“attributeerror:'str' object has no attribute 'x_l“
