Writing binary files in windows
kb1pkl at aim.com
Fri Feb 11 22:35:23 EST 2011
On 02/11/2011 10:20 PM, Abhishek Gulyani wrote:
> When I write binary files in windows:
> file = open(r'D:\Data.bin','wb')
> file.write('Random text')
> and then open the file it just shows up as normal text. There is nothing
> binary about it. Why is that?
> Sorry if this is too much of a noobie question. I tried googling around but
> couldn't find an answer.
It is binary! What are you expecting? You wrote text to a file, so when
you open the file with whatever, it displays like text. Even when you
don't open a file as binary, it is still a binary file. Otherwise it
More information about the Python-list