Oct-04-2022, 11:36 AM
Hi Team,
I have input data in csv file like below.
1,EAST,100
2,WEST,200
3,SOUTH,300
4,NORTH,400
I want to add these headers to above input file at line one.
ID,Region,Salary
Final should look like this.
Add headers to csv
ID,Region,Salary
1,EAST,100
2,WEST,200
3,SOUTH,300
4,NORTH,400
with open("data1.csv","w") as f:
f.write()
I have input data in csv file like below.
1,EAST,100
2,WEST,200
3,SOUTH,300
4,NORTH,400
I want to add these headers to above input file at line one.
ID,Region,Salary
Final should look like this.
Add headers to csv
ID,Region,Salary
1,EAST,100
2,WEST,200
3,SOUTH,300
4,NORTH,400
with open("data1.csv","w") as f:
f.write()