On Windows a script where de endline are the system line sep, the files are open with a double line in Eric4, Notepad++ or Gedit but they are correctly displayed in the MS Bloc-Notes.

Example with this code:
----------------------------------------------
# -*- coding: utf-8 -*-

import os
L_SEP = os.linesep

def write():
    strings = ['# -*- coding: utf-8 -*-\n',
                'import os\n',
                'import sys\n']
    with open('writetest.py', 'w') as outf:
        for s in strings:
            outf.write(s.replace('\n', L_SEP))

write()
----------------------------------------------

The syntax `s.replace('\n', L_SEP)`is required for portability.

Regards
-
Vincent V.V
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to