카테고리 없음
python 디렉토리 정렬
행복을전해요
2020. 12. 14. 22:56
python 디렉토리 정렬
숫자순으로 정렬할 경우
dd = sorted(os.listdir("./img/"), key=int)
money = "./img/"+ dd[0]+"/money.txt"
print(money)
file = open(money,"r",encoding='UTF8')
money = file.readlines()
print(money)
file.close()
title = "./img/"+ dd[0]+"/title.txt"
file = open(title,"r",encoding='UTF8')
title = file.readlines()
print(title)
file.close()
url = "./img/"+ dd[0]+"/url.txt"
file = open(url,"r",encoding='UTF8')
url = file.readlines()
print(url)
file.close()