1. glob 이용

import glob

# 폴더에 있는 모든 파일 경로 가져오기
all_files = glob.glob("/test/temp/*")

# 폴더에 있는 text 파일 경로만 가져오기
text_files = glob.glob("/test/temp/*.txt")

# 폴더에 있는 json 파일 경로만 가져오기
json_files = glob.glob("/test/temp/*.json")

 

'Language > Python' 카테고리의 다른 글

[Python] float를 int로 변환  (0) 2021.06.10

+ Recent posts