Skip to content

Commit e9387ea

Browse files
committed
introduce a new platform-specific variable: os.linesep is the
platform's line separator. \n on Unix, \r\n on DOS, OS/2 and Windows, \r on Macs.
1 parent fa0b6ab commit e9387ea

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Lib/os.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
if 'posix' in _names:
2727
name = 'posix'
28+
linesep = '\n'
2829
curdir = '.'; pardir = '..'; sep = '/'; pathsep = ':'
2930
defpath = ':/bin:/usr/bin'
3031
from posix import *
@@ -37,6 +38,7 @@
3738
del posixpath
3839
elif 'nt' in _names:
3940
name = 'nt'
41+
linesep = '\r\n'
4042
curdir = '.'; pardir = '..'; sep = '\\'; pathsep = ';'
4143
defpath = '.;C:\\bin'
4244
from nt import *
@@ -49,6 +51,7 @@
4951
del ntpath
5052
elif 'dos' in _names:
5153
name = 'dos'
54+
linesep = '\r\n'
5255
curdir = '.'; pardir = '..'; sep = '\\'; pathsep = ';'
5356
defpath = '.;C:\\bin'
5457
from dos import *
@@ -61,6 +64,7 @@
6164
del dospath
6265
elif 'os2' in _names:
6366
name = 'os2'
67+
linesep = '\r\n'
6468
curdir = '.'; pardir = '..'; sep = '\\'; pathsep = ';'
6569
defpath = '.;C:\\bin'
6670
from os2 import *
@@ -73,6 +77,7 @@
7377
del ntpath
7478
elif 'mac' in _names:
7579
name = 'mac'
80+
linesep = '\r'
7681
curdir = ':'; pardir = '::'; sep = ':'; pathsep = '\n'
7782
defpath = ':'
7883
from mac import *

0 commit comments

Comments
 (0)