I have multiple .csv files and I combined them in single .csv file with the use of python programming.
Now I need to automate the process of replacing the content of one column in a .csv file with the use of python. I can also open the .csv file using Notepad and replace the content of the column but the file is very huge and it is taking a long time.
Name ID class Num
"kanika",""University ISD_po.log";" University /projects/asd/new/high/sde"","MBA","12"
"Ambika",""University ISD_po.log";" University /projects/asd/new/high/sde"","MS","13"
In the above, I need to replace the content of ID column. The new content in the ID column should be "input".
This Id column is enclosed with 2 double quotes and has some extra spaces as well. Whereas other columns have only 1 double quote.
Is there any way to do it in python?
To combine multiple .csv files, the code is:
fout=open("out.csv","a")
for line in open("sh1.csv"):
fout.write(line)
for num in range(2,21):
f=open("sh"+str(num)+".csv")
f.next()
for line in f:
fout.write(line)
f.close()
fout.close()