newbieish question

Sean 'Shaleh' Perry shalehperry at attbi.com
Tue Feb 19 17:28:13 EST 2002


On 19-Feb-2002 Mike Carifio wrote:
> Is there a way to turn off the interpretation of "\n" on sys.platform ==
> "win32"
> when writing to a file?
> 
> Here's an example:
> 
> fh = open("a_file.text", "w") # say
> fw.write("\n")  # writes \r\n on win32
> fw.write(chr(10))  # also appears to write \r\n on win32; can I get just
> line feed?
> 

open the file in binary mode.  The newline interpolation is only done in ascii
mode.




More information about the Python-list mailing list