Possible Duplicate:
How do I concatenate files in Python?
def copy_file(file_name,copy_file_name,copies):
i=0
a=open(file_name,'r')
f=open(copy_file_name,'w')
for line in a:
while i<copies:
f.write(line)
i+=1
a.close()
f.close()
return
copy_file("D:\student\example2.txt","D:\student\copy_file_name.txt",3)
i need to copy a text file 3 times to another file and the loop stops after the first line:(
def merge_file(list,file_name):
for i in range(len(list)):
a=open(list[i],'r')
f=open(file_name,'w')
f.write(list[i])
f.close
a.close
return
merge_file([("D:\student\example2.txt"),("D:\student\example3.txt")],"D:\student\copy_file_name.txt")
i need to copy list of files into one file.