파일 읽고 쓰기 Posted on 2021-06-19 Edited on 2021-06-21 In Language , Python Views: with문과 함께 사용하기12with open("foo.txt", "w") as f: f.write("Life is too short, you need python") 12with open("foo.txt", "r") as f: lines = [line.rstrip("\n") for line in f] rstrip() 을 이용해 \n 을 제외한 line 값을 배열에 저장한다.