Skip to content Skip to sidebar Skip to footer

Best Method For Appending New Column In Tab Delimited Csv File

How can I read and write at the same time in csv file. def read_txt_file(txt_filename): def get_all_sheet_values(filename): lines = [] myFile= open( filename, 'rU' ) f

Solution 1:

Files don't work that way. Write to a new file, and rename it after.

Solution 2:

You can't. When you add the column you are making each line longer. If you were to write it out before going to the next line you would overwrite a portion of it.

Post a Comment for "Best Method For Appending New Column In Tab Delimited Csv File"