Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 23rd, 2004, 09:05 AM
Swede Swede is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 2 Swede User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation 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!

Reply With Quote
  #2  
Old November 23rd, 2004, 09:32 AM
Dag Dag is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 113 Dag User rank is Private First Class (20 - 50 Reputation Level)Dag User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 3 Days 4 h 5 m 47 sec
Reputation Power: 5
Send a message via MSN to Dag
Quote:
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

Reply With Quote
  #3  
Old November 23rd, 2004, 09:39 AM
Swede Swede is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 2 Swede User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Quote:
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?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > Read binary file with stressdata


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT