[Pythonmac-SIG] os.linesep?

Chris,Mann me@mrmann.com
Tue, 02 Nov 1999 14:04:09 -0500


on 11/2/99 1:54 PM, Just van Rossum at just@letterror.com wrote:

> I think the original poster is confused by the behavior of files opened in
> text mode: \r and \n will be exchanged so an oridinary Mac text file will
> *look* like a Unix file as far as the program is concerned, but it's still
> a Mac file on disk.
> 
> So: if you're opening files in text mode, you should always assume \n, and
> not use os.linesep...

No, here's the bit of code that's writing out to a file:
        file = file + '.all'
        fileID = open(file, 'w')
        for bug in self.bugs:
            if not bug.err:
                fileID.write(bug.summary(delimiter))
                fileID.write(linesep)
                iBugCount = iBugCount + 1
        fileID.close()

basically it's a list of strings that i'm writing to the file one line at a
time.  But if I use os.linesep and then open that text file with BBEdit, it
says it's a Unix formatted file, not Mac.  I would assume that it would be
Mac formatted since I'm using os.linesep.

-c