8000 Update npyio.py set newlines for header and footer · numpy/numpy@295f5a8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 295f5a8

Browse files
authored
Update npyio.py set newlines for header and footer
1 parent c48b746 commit 295f5a8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

numpy/lib/npyio.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1552,7 +1552,7 @@ def first_write(self, v):
15521552
# newlines, and this function needs to write newlines.
15531553
if newline is None:
15541554
open_newline = None
1555-
newline = '\n'
1555+
newline = os.linesep
15561556
else:
15571557
open_newline = newline
15581558

@@ -1618,7 +1618,7 @@ def first_write(self, v):
16181618
raise ValueError('invalid fmt: %r' % (fmt,))
16191619

16201620
if len(header) > 0:
1621-
header = header.replace('\n', '\n' + comments)
1621+
header = header.replace(newline, newline + comments)
16221622
fh.write(comments + header + newline)
16231623
if iscomplex_X:
16241624
for row in X:
@@ -1639,7 +1639,7 @@ def first_write(self, v):
16391639
fh.write(v)
16401640

16411641
if len(footer) > 0:
1642-
footer = footer.replace('\n', '\n' + comments)
1642+
footer = footer.replace(newline, newline + comments)
16431643
fh.write(comments + footer + newline)
16441644
finally:
16451645
if own_fh:

0 commit comments

Comments
 (0)
0