I am working with reading and writing with csv files. When I read in the values I am performing a strip(\n\r\t) along with lstrip()
and rstrip()
for white spaces. When I go to write my lists, this only occurs on a windows machine, there is an extra row being written in true rows of data. Again this only happens for execution with windows machine not mac os. Here is my current write function that takes in two lists each list has had its headers and are both lists of tuples in the form(sampId,execId) appended and writes correctly other than the extra rows. Output and failed_list
are both lists of tuples. Again output works correctly when performed on mac, but incorrectly on windows in which it adds an extra row of empty data between each data.
def fileWrite(output,failed_list_csv_out):
fileToWrite = open('SampleId_ExecutionId.csv','w')
with fileToWrite:
writer = csv.writer(fileToWrite)
writer.writerows(output)
writer.writerows(failed_list_csv_out)