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(source, target): source_f = open(source) target_f = open(target, 'w') while True: line = source_f.readline() if len(line) == 0: break target_f.write(line) source_f.close() target_f.close() copy('source.txt', 'target.txt')

Questions about programming?Chat with your personal AI assistant