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 readFile(filename, targetFile): f = open(filename, "r") t = open(targetFile, "w") for l in f.readlines(): t.write(l) f.close t.close readFile("sample.txt", "target.txt")

Questions about programming?Chat with your personal AI assistant