python
来源:互联网 发布:python中的sys.argv 编辑:程序博客网 时间:2024/05/14 08:06
import osimport os.pathrootdir = “d:\data” # 指明被遍历的文件夹for parent,dirnames,filenames in os.walk(rootdir): #三个参数:分别返回1.父目录 2.所有文件夹名字(不含路径) 3.所有文件名字 for dirname in dirnames: #输出文件夹信息 print "parent is:" + parent print "dirname is" + dirname for filename in filenames: #输出文件信息 print "parent is": + parent print "filename is:" + filename print "the full name of the file is:" + os.path.join(parent,filename) #输出文件路径信息 #windows下为:d:\data\query_text\EL_00154
0 0
- Python
- Python
- Python
- python
- Python
- PYTHON
- Python
- Python
- Python
- Python
- Python
- Python
- Python
- Python
- Python
- Python
- python
- Python
- navcat excel数据导入mysql的方法
- 操作系统(独木桥问题)
- acm程序设计书中题目k
- volatile详解
- oj刷题—Problem C: C语言习题5.26--文件操作3
- python
- Bloom Filter布隆过滤器
- 特征选择
- Python 升级和pip安装
- C语言基本类型声明、初始化、大小及格式说明符总结
- 【机器学习】感知机的一点理解
- pixhawk 整体架构的认识
- JSS 第 2 篇
- java创建一个统计在线人数的监听器