3 ms·
I recently had to deal with this for writing a file format that mandates CR LF line endings regardless of platform. Thankfully, Python 3 makes it painless to de
by wlesieutre 11y ago
I recently had to deal with this for writing a file format that mandates CR LF line endings regardless of platform. Thankfully, Python 3 makes it painless to deal with, once you track down how. For anyone who's been spared so far:
file = open(path, "w", newline="\r\n")
- kevin_thibedeau 11y agoAlso usable from 2.7 with backported and forward compatible io.open().