일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
29 | 30 |
Tags
- numpy
- Python
- file
- pandas
- GitLab
- judge
- Paper
- AI
- KAKAO
- TORCH
- Database
- Package
- git
- evaluation
- enV
- PostgreSQL
- pytorch
- Windows
- Laravel
- format
- Container
- Converting
- 책갈피
- Linux
- Mac
- list
- docker
- Flask
- DB
- LLM
Archives
- Today
- Total
목록Search (1)
Daily Develope
[Python] 폴더 및 파일 탐색
ㅇ 폴더 및 파일 탐색 - 예) target_dir 에서 png, jpg 파일 출력 (non-recursion) target_dir = f'{os.getcwd()}/sample' for root, dirs, files in os.walk(target_dir): for file in files: if file.endswith(('.png', 'jpg')): print(file) ㅇ 파일 존재 확인 import pathlib if pathlib.Path('myfile.txt').exists(): print("exists")
Develope/Python
2022. 4. 6. 09:22