I have two text files test1.txt
and test2.txt
. I want to be able to read test1.txt
contents and write it to text2.txt
at a specific line.
I have been able to read the contents of test1.txt
and write them to a blank test2.txt
.
Now I want to change my code to read context of test1.txt
and write them to a non empty text2.txt
.
with open("/test1.txt") as f:
lines = f.readlines()
with open("/test2.txt", "w") as f1:
f1.writelines(lines)
How can I insert the contents of test1.txt
to test2.txt
at line 20.