Create reverse_line.py

This commit is contained in:
Nguyen Viet Tuan
2022-07-04 22:56:29 +07:00
committed by GitHub
parent 2fcc1840c4
commit efa5193a42
+7
View File
@@ -0,0 +1,7 @@
import csv
with open("EURUSD_threemonths.csv") as fr, open("reverse_EURUSD_threemonths.csv", "w", newline="") as fw:
cr = csv.reader(fr, delimiter=",")
cw = csv.writer(fw, delimiter=",")
cw.writerow(next(cr)) # write title as-is
cw.writerows(reversed(list(cr)))