Skip to content
Advertisement

Tag: writer

Write new field with CSV writer

I am trying to write a new row on CSV A based on the ID number if the ID number. For example as seen on CSV B if ID = 1 then the student is a Female, ID = 2 is a Male. CSV A (has 3 columns) CSV B (has 2 columns) Based on this information the desired output

Python CSV Writer leave a empty line at the end of the file

the following code leave a empty white line at the end of the txt file. how can i not have the writerows not terminate the last line? Answer Firstly, since you are using with open as myFile you don’t need myFile.close(), that is done automatically when you remove the indent. Secondly, if you are willing to add another part to

Advertisement