hello, I want to change n bytes of a binary file
could ildg
could.net at gmail.com
Tue Nov 1 09:48:49 EST 2005
I want to encrypt a very large birany file,
but if to change the whole file, it will take very long time,
so I just want to change n(n is an int) bytes of the file.
but when I turned to the file I/O of python, I found that file object can
only read and write strings,
so how can I do the binary stuff?
I want a encrypt function like below:
def encrypt(filename,n):
f=open(filename,"rb")
a=f.read(n)
//encrypt the n byte bit by bit and then write back to the beginning of the
file
//assume I only want every bit change from 0->1 and 1->0, how to do it than?
Thank you so much!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20051101/b75f5715/attachment.html>
More information about the Python-list
mailing list