[Newbie] line separators in file-output

Duncan Booth duncan at rcp.co.uk
Wed Mar 21 09:53:30 EST 2001


Daniel Orlowski <daniel.orlowski at bg-sys.de> wrote in <3AB8AEDA.2D2BD105 at bg-
sys.de>:

>If I in Python uder Windows do smth like this:
>
>>>> File=open("test","w")
>>>> File.write("a line"+"\n")
>>>> File.close()
>
>I have data in file test:
>'a line\015\012'
>
>How can I prevent output of  '\015'?
>
Open the file in binary mode:
>>> File=open("test", "wb")




More information about the Python-list mailing list