I have some txt files in '\data' such as '1.txt'and '2.txt'. Now I want to add the last line of these two files in the another file named '3.txt' but I'm only able to add the last line of '1.txt' into the '3.txt'
from sys import argv
from os.path import exists
script,from_file,to_file=argv
in_file=open(from_file) in_data=in_file.readlines() count=len(in_data)
#print in_data[3] print count line=in_data[count-1]
in_file.close()
out_file=open(to_file,'w')
out_file.write(line)
out_file.close()
in_file.close()