glob

YU NA Joe·2022년 5월 16일
0
import glob 

glob.glob("C:\Python\works\Hiring_Recommendation/*.txt", recursive = True)

['C:\\Python\\works\\Hiring_Recommendation\\TEST.txt',
 'C:\\Python\\works\\Hiring_Recommendation\\TEST1.txt',
 'C:\\Python\\works\\Hiring_Recommendation\\TEST2.txt',
 'C:\\Python\\works\\Hiring_Recommendation\\TEST3.txt',
 'C:\\Python\\works\\Hiring_Recommendation\\TEST4.txt',
 'C:\\Python\\works\\Hiring_Recommendation\\TEST5.txt']
 
-------------------------------------------------------- 
glob.glob("C:\Python\works\Hiring_Recommendation/**/*.txt", recursive = True)

['C:\\Python\\works\\Hiring_Recommendation\\TEST.txt',
 'C:\\Python\\works\\Hiring_Recommendation\\TEST1.txt',
 'C:\\Python\\works\\Hiring_Recommendation\\TEST2.txt',
 'C:\\Python\\works\\Hiring_Recommendation\\TEST3.txt',
 'C:\\Python\\works\\Hiring_Recommendation\\TEST4.txt',
 'C:\\Python\\works\\Hiring_Recommendation\\TEST5.txt',
 'C:\\Python\\works\\Hiring_Recommendation\\data\\TEST6.txt']
 

* 와 ** 차이?

**는 여러개의 경로를 포함한다

0개의 댓글