+ 1
Changing endian format in a python file
Hi, is there a way to change the endianness (big or little) of the entire python file? My computer's default is little and I want all of the variables in my file big. If not, what is the quickest and simplest way of converting each number to big endian? Thanks a lot
3 Answers
+ 4
Afek Kalmani ,
> please do a try with google for *python little or big endian*.
you will find a lot of information about this topic, especially from stackoverflow.com, and you have to invest some time and effort on getting the particular information that you need.
+ 2
Thanks, I did search, but apparently what I searched for, and what I asked, are both wrong in their meaning. I searched for an endian as a characteristic, but computers don't work like that.
I got it somehow, thanks for trying to help :)
+ 1
convert endianness...
That's a rare one.
from StackOverflow:
(no guarantee, test first to see if it works.)
with open(fileName, "rb") as f: arrayName = numpy.fromfile(f, numpy.float32) arrayName.byteswap(True)
thread:
https://stackoverflow.com/questions/1632673/JUMP_LINK__&&__python__&&__JUMP_LINK-file-slurp-w-endian-conversion