#coding:utf-8
import os
#利用os.walk()得到相应的文件名,并利用tuple()将之转换为tuple.
zhuangzi_names=tuple(os.walk(top=‘D:\Alfred20151208\Alfred Thesis Preparation\莊子\莊子數據2‘, topdown=True, onerror=None, followlinks=False))
#得到文件名
passage_names=(zhuangzi_names[0])[2]
原文:http://www.cnblogs.com/lww1993/p/7471812.html