hello, I want to change n bytes of a binary file
could ildg
could.net at gmail.com
Tue Nov 1 10:12:03 EST 2005
More information about the Python-list mailing list
Tue Nov 1 10:12:03 EST 2005
- Previous message (by thread): hello, I want to change n bytes of a binary file
- Next message (by thread): hello, I want to change n bytes of a binary file
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 11/1/05, Fredrik Lundh <fredrik at pythonware.com> wrote: > > "could ildg" wrote: > > > 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? > > 8-bit strings contain bytes. > > > I want a encrypt function like below: > > def encrypt(filename,n): > > f = open(filename,"rb+") > > > a=f.read(n) > > b = encrypt(a) ^^^^^^^^Thank you~~,but where is the encrypt defined? f.seek(0) # rewind > f.write(b) > f.close() > > </F> > > > > -- > http://mail.python.org/mailman/listinfo/python-list > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-list/attachments/20051101/28a5f256/attachment.html>
- Previous message (by thread): hello, I want to change n bytes of a binary file
- Next message (by thread): hello, I want to change n bytes of a binary file
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list