read from source file one line at a time and write to target file one line at time.
def copy_file(source, target): source_file = open(source) target_file = open(target, "w") for line in source_file: target_file.write(line) source_file.close() target_file.close()