read text file byte by byte

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Sat Dec 12 05:33:09 EST 2009


On Fri, 11 Dec 2009 23:16:42 -0800, 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 

f = open(filename, 'rb')
f.read(1)

will read a single byte.




2) Should I use streams? 

What do you mean by "streams"?



-- 
Steven


-- 
Steven



More information about the Python-list mailing list