changing an entry ina binary file using python --URGENT

hi all,

please help me...i am really in an awkard position.
i need to change an entry in a binary file.
I am having a binary file EG.bin and EG.cfg.
i need to open the cfg file and change an entry in that..
right now what ppl are doing is ... opening the cfg(configuration file) file using VC++
then change the content manually
but i need to write a python script that solves the problem.
i tried opening the file using

binfile = file("EG.cfg","rb")
for line in binfile.readlines(): print line# Now close it againbinfile.close()
what now happens is i am not getting the values … instead of that i'm getting junk values…
Any idea how to open a binary file so that we can get the values correctly???-- Regards,Shine Anne

···

--- On Thu 08/03, Shine Anne < m2ids2005@gmail.com > wrote:
From: Shine Anne [mailto: m2ids2005@gmail.com]
To: wxPython-users@lists.wxwidgets.org
Date: Thu, 3 Aug 2006 17:38:20 +0530
Subject: [wxPython-users] changing an entry ina binary file using python --URGENT

#---------------------------------

First of all, I'm probably going to have to change my mail
address for this group - excite.com probably will make hash
out of your mail.

1) Binary files often look like junk - often they are
encoded, either for compact data storage, or some
degree of security.

2) readline() I think expects a normal text file with
standard end of line terminators. You may have better
luck, if you know the exact format of your binary
file with seek() and read() - both of them take an
integer argument seek(n) will position you at byte n
in the file and read(n) will pull in n bytes.

3) more information about the format of this binary
file might help.

Regards,

Chris

_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!