views:

32

answers:

1
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)
+2  A: 

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

Ofir