Cody Bable

Generation

generate functionFri, 21 Apr 2023

read from one file and write to another file line by line until end of file

with open(infile, 'r') as inf, open(outfile, 'w') as outf: for line in inf: outf.write(line) f = open(infile, 'r') try: for line in f: print(line) finally: f.close() with open(infile, 'r') as f: for line in f: print(line)

Questions about programming?Chat with your personal AI assistant