-
[file] copy the file🐍 파이썬/파이썬 연습문제 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)
'🐍 파이썬 > 파이썬 연습문제' 카테고리의 다른 글
[list] find minimum in array (0) 2022.07.20 [modulo/devisor] sum up digit (0) 2022.07.18 [random/inf loop] guessing game (0) 2022.07.17 [input/string interpolation] 유저에게 인풋을 받아서 프린트하기 (0) 2022.07.17 [modulo/divisor] Vending machine change 거스름돈 문제 (0) 2022.07.17