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 | 31 |
Tags
- Photograph
- pattaya
- 촬영
- Thai
- 커밋
- snap
- Studio
- REST
- 리비전
- honeyJarStudio
- 스냅
- 여행
- 스튜디오
- 파타야
- travel
- Street
- Photo
- 여름휴가
- 바다
- Thailand
- revision
- 태국
- 꿀단지스튜디오
- 체크아웃
- svn
- commit
- 사진
- checkout
- Sea
- honeyJar
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