import glob
import os

data_Path = os.path.join(os.getcwd(), 'data')

# # '*'는 임의 길이의 모든 문자열을 의미한다.
output = glob.glob(data_Path + '/*.txt')
print(output)
print('-' * 20) 

# '?'는 한자리의 문자를 의미한다.
output = glob.glob(data_Path + '/temp?.txt')
print(output)
print('-' * 20)  

# '[2-3]'은 2~3사이의 숫자를 의미한다.
output = glob.glob(data_Path + '/temp[2~3]?.txt')
print(output)
print('-' * 20)

# recursive=True는 하위경로 검색여부이다.
output = glob.glob(data_Path + '/*.txt', recursive=True)
print(output)

+ Recent posts