써니(>_<) 2022. 7. 17. 07:42

문제 : Implement a function that copies the contents of a file to a new file. The function should add a header (one line of arbitrary text) to the top

def copy_file(src, dest, header):

	with open (src, 'r') as f_in , open (dest, 'w') as f_out:
		
        f_out.write(header)
        
		for line in f_in.readlines:
			f_out.write(line)