使用`struct.pack`将数据写入文件时出错

使用`struct.pack`将数据写入文件时出错,第1张

使用`struct.pack`将数据写入文件时出错

以二进制模式打开文件:

outputFile = open('testDS', 'wb')

否则,文件对象可能会对二进制数据中显示的换行符进行魔术转换,从而导致其他字符被写入文件。参见例如https://docs.python.org/2/tutorial/inputoutput.html#reading-
and-writing-
files



欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5674727.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-16

发表评论

登录后才能评论

评论列表(0条)

保存