duongame
Android developer
Thursday, September 11, 2014
Python 디렉토리 순회 탐색하기
#이것도 os의 기능인가보다.
import os
#현재 디렉토리부터 모든 하위디렉토리의 디렉토리와 파일을 보여준다.
for dirname, dirnames, filenames in os.walk('.'):
for subdirname in dirnames:
name = os.path.join(dirname, subdirname)
print name
for filename in filenames:
print os.path.join(dirname, filename)
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment