read text file byte by byte
census
census at no-email.de
Sat Dec 12 04:35:55 EST 2009
daved170 wrote:
> Hello everybody,
> I need to read a text file byte after byte.
> Eache byte is sent to a function that scramble it
> and I need to write the result to binary file.
>
> I've got some questions -
> 1) How do I read the file byte by byte
> 2) Should I use streams? If so and I get my entire scrambled text in
> stream can I just write it to the binary file?
>
> Thanks
> Dave
f = open ("binaryfile", "r")
bytearray = map (ord, f.read () )
Stores the content of binaryfile in the list bytearray.
More information about the Python-list
mailing list