본문 바로가기
파이썬 언어

파이썬으로 폴더내의 텍스트 파일 목록만들기

by treeCoder 2021. 10. 1.

파이썬으로 폴더내의 텍스트 파일의 목록을 만드는 방법이다.
#————————————————————————
import os

path = '여기에 폴더 경로를 쓰세요.'
file_list = os.listdir(path)

name_list = []

for itm in file_list:
    if ".txt" in file_name:
        filePath = path + file_name
        print(filePath)

#————————————————————————

댓글