I have 2 files " CSV "
i want to insert the lines from the first file into the second file
how to insert specific numbers of lines like example the first 10 lines and also how to insert the all file
how to do this with python ?
for example :
First file include :
1 , A
2 , B
3 , C
Second file include :
4 , D
i want to add the lines from the first file to the second file so second file will be like this :
4 , D
1 , A
2 , B
3 , C
This is the code i use :
outfile = open("second.csv", "w", encoding="utf8")
for line in open("first.csv", "r", encoding="utf8"):
outfile.write(line)
outfile.close()
But the problem in my code is not insert more lines the code delete what in second file and then insert into it what in the first file ( what i want is to insert lines without delete what was in the second file )