开发者

Python: Mat-File into hex-values

filename = r"C:\Dokumente und Einstellungen\sschnei1\Desktop\a.mat"
print open(filename, "r").read().encode("hex")

The code above only work for text files. But I want to read out the hex-values of mat-files.

EDIT: my little hex-editor

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


try open(filename,"rb") - open it as a binary file

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜