On Wed, Mar 5, 2014 at 12:18 AM, Peter Otten <__pete...@web.de> wrote:
> loial wrote:
>
>> How do I read a binary file, find/identify a character string and replace
>> it with another character string and write out to another file?
>>
>> Its the finding of the string in a binary file that I am not clear on.
>
> That's not possible. You have to convert either binary to string or string
> to binary before you can replace. Whatever you choose, you have to know the
> encoding of the file.

If it's actually a binary file (as in, an executable, or an image, or
something), then the *file* won't have an encoding, so you'll need to
know the encoding of the particular string you want and encode your
string to bytes.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to