MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   Python:将Mat-File转换为十六进制值 (https://www.labfans.com/bbs/showthread.php?t=23503)

poster 2019-12-10 20:41

Python:将Mat-File转换为十六进制值
 
filename = r"C:\Dokumente und Einstellungen\sschnei1\Desktop\a.mat" print open(filename, "r").read().encode("hex") 上面的代码仅适用于文本文件。但是我想读出mat文件的十六进制值。

编辑:我的小十六进制编辑器

from textwrap import fill filename = r"C:\a.mat" hexvalues = open(filename, "rb").read().encode("hex") print fill(hexvalues,16)

[B]回答:[/B]

尝试open(filename,"rb") -将其作为二进制文件打开



[url=https://stackoverflow.com/questions/2958839]更多&回答...[/url]


所有时间均为北京时间。现在的时间是 01:02

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.