-
python file line read and setTech/Python 2019. 6. 15. 11:20반응형
import pathlib
file_name = "sample.txt"
current_path = pathlib.Path(__file__).parent
with open(current_path.joinpath(file_name)) as f:
set_samples = set(map(str.strip, f)) #파일을 라인단위로 읽어 set 으로 만든다.
반응형'Tech > Python' 카테고리의 다른 글
python data class (0) 2020.01.19 Python application with Docker Image build and Run (0) 2019.07.14 pymongo usage (0) 2019.06.08 Commands for Python with Git project (0) 2019.02.10 python logging config (0) 2019.02.04