Cody Bable

Generation

generate functionMon, 24 Apr 2023

read from source file one line at a time and write to target file one line at time.

def copy(src_file, target_file): with open(src_file) as fin: with open(target_file, 'w') as fout: while True: line = fin.readline() if not line: break fout.write(line) copy('source.txt', 'target.txt')

Questions about programming?Chat with your personal AI assistant