I had made the following code in codevy.io and the Python installed in codenvy is 3.5.1. I got this code and put it to run on windows 8 with python 3.6.1.
The purpose of the code is to clean up a CSV file and write them concatenated in a single CSV file. In codenvy it's working, but when I run the code in windows the output file gets blank lines between each row, I want to know how to get around this:
import csv
import sys
import os
import glob
interesting_files = glob.glob("Vendas_artigos*")
with open('SaidaVendasArtigos.csv','wt',encoding='utf-8-sig') as fout:
for filename in sorted(interesting_files):
with open(filename,'rt',encoding='utf-8-sig') as fin:
next(fin)
reader = csv.reader(fin)
writer = csv.writer(fout)
for row in reader:
if row:
row.pop(0)
writer.writerow(row)
Python 3.5.1 on Codenvy:
row
row
row
Python 3.6.1 on Windows 8:
row
row
row