Sunday 29 December 2019

How to parse the value to csv with column name

I would like to update specific columns in a csv file. I want to update the first column in the function func1 and the second column in function func2:

def func1(x):
    data = 'test1'
    file = open("test.csv","a+")
    file.write(data)
    file.close()
    return data

def func2(x):
    data = 'test2'
    file = open("test.csv","a+")
    file.write(data)
    file.close()
    return data

Expected out

col1,col2
test1,test2

How do I specify the column to be updated? Here, no file is getting created.



from How to parse the value to csv with column name

No comments:

Post a Comment