Cody Bable

Generation

generate functionFri, 21 Apr 2023

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')

Questions about programming?Chat with your personal AI assistant