[Python-au] Python os.linesep question

John Machin sjmachin at lexicon.net
Tue Dec 15 14:50:59 UTC 2009


On 15/12/2009 11:28 PM, Stephen George wrote:
> 
> Hi,
> Have a question about use of os.linesep, as it seems to not work as 
> advertised, unless I am doing something wrong.
> 
> I've tried on windows, cygwin and linux.
> I'm trying to write a text file and enforce '\r\n' for endofline from 
> both windows and cygwin environment, currently cygwin  outputs '\n'
> 
> I'm under impression from [1] that I can change the value of os.linesep 
> to 'enforce' my requirement
> I'm under impression from [2] that i should NOT use os.linesep directly 
> in my strings as a new line character

[2] is the official Python docs. [1] is somebody I'd not heard of. Case 
closed, IMHO.



More information about the python-au mailing list