1

I have a 3-dimensional matrix (150x50x27) as a bin file. In the Julia programming language, I used

data=deserialize("administration/data.bin")

and it showed the 3D matrix well.

In Python, I tried

f=open("administration/data.bin","rb")
data=f.read()

However, it shows the strange result as follow:

b'7JL\x11\x04\x00...(omit)..xaa\xd3\xcb~\xd9\x80\xe7@' 

how to solve it?

Manu Han
  • 71
  • 4
  • Does this answer your question? [Reading a binary file with python](https://stackoverflow.com/questions/8710456/reading-a-binary-file-with-python) – Abdul Niyas P M Jun 20 '23 at 11:26
  • 1
    It would be easier to answer you if you provided three simple lines of Julia (if that is what you used to create the file) that create and save your file in a similar format to that you are having trouble with. If the file had linearly increasing numbers or something recognisable it would help build confidence in the decoding.It would also help if you shared that file - use Dropbox or Google Drive or somesuch. Otherwise you will need to find somebody who knows **both** Python **and** Julia to get any help. – Mark Setchell Jun 20 '23 at 11:38
  • 1
    Depends on how the bin file was created. If it represents a serialised object from Julia then unmarshalling to Python is likely to be a challenge – DarkKnight Jun 20 '23 at 11:46
  • @AbdulNiyasPM Thx, I will try it. – Manu Han Jun 20 '23 at 15:19
  • @DarkKnight It is created via Serialised as you guess! It seems that I should make file in another way. – Manu Han Jun 20 '23 at 15:21
  • @MarkSetchell I will try to upload the file if the answers above mentioned is not going to work :) thanks for your nice comment. – Manu Han Jun 20 '23 at 15:22

0 Answers0