4 ms·
I think you should use .replace(os.linesep, "\r\n"), in case the system's newlines coincide with CRLF.
by mar77i 9y ago
I think you should use .replace(os.linesep, "\r\n"), in case the system's newlines coincide with CRLF.
- Bogdanp 9y agoIt's been a while since I've used Windows, but does that matter since I'm using string literals here? I would think that even on platforms like that, literal string lines would be terminated by `\n`.
- gkya 9y agoIf I'm not mistaken CRLF is part of the HTTP spec as a field separator. Edit: I've read the article after this comment, now I see what the parent comment meant. I guess in this case sth like "\r\n".join(["line1", "line2", "line3"]) is best.