- # -*- coding:utf-8 -*-
- #! /usr/bin/python
- import os
- #递归遍历E:\\python\\a目录下所有文件
- def show(arg, dirname, filenames):
- print 'dirname:' + dirname
- for f in filenames:
- if os.path.isfile(dirname+'\\\\'+f):
- print '-----' + f
- os.path.walk('E:\\\\python\\\\a', show, None)
- #该片段来自于http://www.codesnippet.cn/detail/170520133426.html
来源: http://www.codesnippet.cn/detail/170520133426.html