일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- pip
- SPL
- CNN
- synology
- Button
- pandas
- 알고리즘
- keras
- LSTM
- RNN
- pycharm
- GitHub
- imread
- 삼성소프트웨어멤버십
- Splunk
- Series
- Lotto
- index
- GT-S80
- Numpy
- DFS
- mariadb
- install
- mean
- E-P1
- SciPy
- dataframe
- ipad
- javascript
- Python
Archives
- Today
- Total
잠토의 잠망경
[python] glob, Directory 하위 파일 List 읽기 본문
지정된 위치의 File List를 읽기위한 방법
Github
https://github.com/yiwonjae/Project_Python_Lib/blob/master/Files/Directorys.py
import glob
'''
목적: 원하는 폴더에 있는 file 이름을 찾아서 return한다.
i ) path : 폴더 및 파일 이름, *.txt, *.* 사용 가능
o ) list : file 이름 list
'''
def findFiles(path:str)->list:
fileList = glob.glob(path)
print(fileList)
return fileList
if __name__ == '__main__':
path = "../datas/sincontan*.txt"
files = findFiles(path)
print('files type: {0}, len: {1}'.format(type(files), len(files)))
Comments