format - Human-readable binary data using Python -


My work requires that I do a mathematical simulation whose parameters come from a binary file without a simulator problem such as binary Can read the file.

However, I need to look inside the binary file to ensure that I need them, and I do not think it's capable of doing this.

I would like to write a script in Python which will allow me to read in a binary file, search for parameters, and display their values.

What do I know about binary files:

It represents simple text (as opposed to an image or sod file). It is a piece of code that can "dump" the file in the "readable" format: If I open that dump in Amax, then I will find things like this:

  CENTRAL_BODY = 'SUN ' 

All files are just a series of similar instructions. I can use that dump code, but I have so much that it is so.

This is a very trivial question, and I apologize for not knowing better. I thought I was a skilled programmer!

Many thanks.

It seems that this 'dump' program is already necessary that you want to: interpret the binary file do. I think my approach will be to write a dragon program that can take a dump file, remove the parameters you want and display them.

Then parse it with something like this:

Myparms.py:

  Importing the line for sys.stdin in line D = {}: Parts = line.split ("=", 2) If LAN (Parts) & lt; 2: Continue k = parts [0]. Strip () V = parts [1]. Strip () D [K] = V print D ['CNRRLBODI']  

This way Use:

Dump Parameter. Bean | Python myparms.py

You have not mentioned a forum or provided information about the format of the dump, but it must be a place to get started.


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -