Cody Bable

Generation

generate functionFri, 21 Apr 2023

read from one file and write to another file line by line

def copyfile(sourcefile, targetfile): with open(sourcefile) as src: with open(targetfile, 'a') as target: for line in src: target.write(line) copyfile('source.txt', 'target.txt')

Questions about programming?Chat with your personal AI assistant