I am having this problem that I am not sure how to solve.
is this a good place to post it?
the csv file as is:
col1,col2,col3,col4,col5 value1,value2,value3,value4,value5 ,,value6,value7,value8,value9 ,,value10,value11,value12,value13`
the expected csv file after the function runs:
Note: the function will be inside a loop, so the parameters will be passed to it each time the loop gets executed, therefore param 1 and 2 are written in the file as the loop executes for the first time.
col1,col2,col3,col4,col5 value1,value2,value3,value4,value5 argument1,argumen2,value6,value7,value8,value9 argument3,argument4,value10,value11,value12,value13
with this function I get the arguments passed on a new line and not inside the empty cells
def append_value(file, *argv): my_file = open(file, 'a') my_line = ','.join([argv]) + '\n' my_file.write(my_line) my_file.close()
could I get some help, please?
I think using with, to open would be better?
Is there another way to edit this csv file without using pandas?