read from one file and write to another file line by line until end of file
def read_file(in_filename): out_filename = in_filename + '_out' with open(in_filename) as in_file, open(out_filename, 'w') as out_file: for line in in_file: out_file.write(line) read_file('test.txt')