For instance here I'm trying to move the contents of file1 into file 2; and this is the code for my attempt which does not work. What's the problem with my code and is there a more efficient method?
file1 = open("textfile.txt", "r")
file2 = open("second textfile.txt","w")
lines = file1.readlines()
for i in range(len(lines)):
file2.write(lines[i]+"\n")
This question is different from other questions of similar type - as it's solution is specific to coding in python.