#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2004
    Posts
    2
    Rep Power
    0

    Read binary file with stressdata


    Hi,

    I'm a new user of Python and I will be using it for writing scripts to the FEM software ABAQUS.

    My problem right now is that I have a binary file with data describing the stressdistribution in a component. I would like to write a python script that reads this file and writes it to a text-file. Is this possible?? And if, how do I start?

    If necessery I can provide you with some C-code that reads from this binary file if this helps.

    Best regards!
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2004
    Posts
    136
    Rep Power
    11
    Originally Posted by Swede
    Hi,

    I'm a new user of Python and I will be using it for writing scripts to the FEM software ABAQUS.

    My problem right now is that I have a binary file with data describing the stressdistribution in a component. I would like to write a python script that reads this file and writes it to a text-file. Is this possible?? And if, how do I start?

    If necessery I can provide you with some C-code that reads from this binary file if this helps.

    Best regards!
    # reading a file
    f = open("filename-to-be-read-here", "r")
    var = f.read()
    f.close()

    # writing the content to another file
    f = open("filename-to-write-here", "w")
    f.write(var)
    f.close()


    Unless your question is how to also format the content from a binary into a text file.. which depends on the binary
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2004
    Posts
    2
    Rep Power
    0
    Originally Posted by Dag
    # reading a file
    f = open("filename-to-be-read-here", "r")
    var = f.read()
    f.close()

    # writing the content to another file
    f = open("filename-to-write-here", "w")
    f.write(var)
    f.close()


    Unless your question is how to also format the content from a binary into a text file.. which depends on the binary
    Thanks alot! But as you mentioned on your last line I'm interested in format the content from binary into a text file. This part of a C-code that I have, could it be of any help to determine the binary?

IMN logo majestic logo threadwatch logo seochat tools logo