John Machin wrote: > Ant wrote: ... > > filehandle.write("xxx \n") > > filehandle.write("xxx \x0a") > > > > and all of these give me a nice windows-style crlf! > > > > Surely there must be a way to do this ... > > and there is: open your output file in binary mode; then it won't > convert every \n to \r\n. ... > | >>> '\n' is '\x0a' > | True
(and F wrote something very similar.) Cheers guys. Shame that fileinput doesn't take an argument to specify the write mode when 'inplace' is True, because it is otherwise makes editing multiple files in place very simple. Is it worth me submitting a patch to fileinput which can take an optional write mode parameter? Cheers, -- http://mail.python.org/mailman/listinfo/python-list