python 遍历文件夹文件代码

时间:2014-05-09 23:49:35   收藏:0   阅读:367
bubuko.com,布布扣
import os
def tree(top):
    for path, names, fnames in os.walk(top):
        for fname in fnames:
            yield os.path.join(path, fname)
 
for name in tree(C:\Users\XXX\Downloads\Test):
    print name
bubuko.com,布布扣

 

python 遍历文件夹文件代码,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!