Created
November 27, 2016 05:02
-
-
Save jtrive84/f1892f37dc9c751e0e6d9581e2f5d04c to your computer and use it in GitHub Desktop.
Suppress double-spaced output in Python 3 by specifying `lineterminator="\n"` to csv.writer instance.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Suppress double-spaced output in Python 3 by specifying `lineterminator="\n"` | |
to csv.writer instance. | |
""" | |
import csv | |
fsrc_pth = "src_pth" | |
fdst_pth = "dst_pth" | |
with open(fdst_pth, 'w') as f1: | |
fdst = csv.writer(f1, lineterminator="\n") | |
with open(fsrc_pth, 'r') as f2: | |
fsrc = csv.reader(f2) | |
for rec in fsrc: fdst.writerow(rec) | |
assert f1.closed | |
assert f2.closed | |
print("Finished") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment