티스토리 뷰

공부

[python] read file

승가비 2023. 1. 13. 18:08
728x90
def read(filename):
    with open(filename) as file:
        lines = [line.rstrip() for line in file]

        return"\n".join(lines)

https://stackoverflow.com/questions/3277503/how-to-read-a-file-line-by-line-into-a-list

 

728x90
댓글