python学习笔记:遍历目录
2013-05-21 17:01
288 查看
import os import os.path if __name__ =='__main__': root_dir='g:\\download' for root, dirs, files in os.walk(root_dir): for dir in dirs: print 'root=%s dir=%s' % (root,dir) #print 'root='+root+' dir='+dir for file in files: print 'root=%s file=%s' % (root,file) #print 'root='+root+' fie='+file
相关文章推荐
- Python学习笔记(2)——遍历目录结构并打印
- Python学习笔记之遍历目录文件(递归和walk())
- python学习笔记(六)目录遍历,异常处理
- Cookbook 笔记:python 遍历目录树
- [Python入门及进阶笔记00]-写在前面(目录/书籍/学习路线/其他)
- python学习笔记 目录和文件操作
- linux编程学习笔记(十二) 遍历目录
- python学习笔记(1)--遍历txt文件,正则匹配替换文字
- Python语言程序设计-学习笔记1:简介及目录
- 【Python学习笔记】IO编程:操作文件和目录
- Python学习笔记(18)-目录操作与文件读写
- Python 遍历字典——学习笔记
- Python学习笔记 --- 循环遍历时间区间
- python学习笔记(五)深拷贝浅拷贝,文件和目录
- “笨办法学python”学习笔记-在终端powershell中对目录进行简单的编辑(一)
- python学习笔记 操作文件和目录
- python的学习笔记之对文件、目录的操作
- Python学习笔记(三):文件和目录工具
- 学习笔记之linux shell遍历目录中的文件
- Python简明教程学习笔记[目录]