Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- travel
- 사진
- honeyJarStudio
- 촬영
- 여름휴가
- Sea
- revision
- checkout
- 리비전
- 스튜디오
- Photograph
- svn
- snap
- commit
- Photo
- REST
- honeyJar
- 스냅
- 바다
- Street
- 여행
- 꿀단지스튜디오
- Thai
- 커밋
- Thailand
- Studio
- 태국
- pattaya
- 체크아웃
- 파타야
Archives
- Today
- Total
목록python 디렉토리 탐색 (1)
꽃무늬 키보드
[python] 디렉토리 전체 탐색, 특정 파일 필터링
특정 디렉토리를 재귀적으로 탐색하여 모든 파일들과 절대경로를 출력 import os pwd = '탐색할 디렉토리 경로' for path, dirs, files in os.walk(pwd): for file in files: print '탐색파일과 절대경로: ' + os.path.join(path, file) 탐색 시, 특정 디렉토리 제외하기 (예: etc 파일 제외) for path, dirs, files in os.walk(pwd): dirs[:] = [dir for dir in dirs if dir != "etc"] 탐색 시, 특정 파일만 추려내기 (예: 확장자가 .pyc인 파일 추리기) for path, dirs, files in os.walk(pwd): for file in files: if os..
Programming/python
2014. 6. 16. 16:04