[Python] 10-3장 파일 입출력 응용(행맨, 파일 안의 문자열 삭제, 빈도수 세기 등)
- 파일에서 단어 읽기 infile = open("C:\\Users\\Desktop\\happy.txt", "r") for line in infile: line = line.rstrip() word_list = line.split() for word in word_list: print(word) infile.close() - 파일 복사 infilename = input("기존 파일 이름: ") outfilename = input("복사된 파일 이름: ") infile = open(infilename, "r") outfile = open(outfilename, "w") s = infile.read() outfile.write(s) infile.close() outfile.close() shutil 모듈 사..