手机
当前位置:查字典教程网 >脚本专栏 >python >python搜索指定目录的方法
python搜索指定目录的方法
摘要:本文实例讲述了python搜索指定目录的方法。分享给大家供大家参考。具体分析如下:#----------------------------...

本文实例讲述了python搜索指定目录的方法。分享给大家供大家参考。具体分析如下:

#------------------------------------- # Name: search_directory.py # Author: Kevin Harris # Last Modified: 02/13/04 # Description: This Python script demonstrates how to use os.walk() # to walk through a directory hierarchy # and list everything # found. #------------------------------------- import os for root, dirs, files in os.walk( os.curdir ): print( "root = " + root ) for file in files: print( "file = " + file ) for dir in dirs: print( "dir = " + dir ) print( "n" ) input( 'nnPress Enter to exit...' )

希望本文所述对大家的Python程序设计有所帮助。

【python搜索指定目录的方法】相关文章:

python中定义结构体的方法

python 文件与目录操作

python列表去重的二种方法

python实现排序算法

用python删除java文件头上版权信息的方法

python3访问sina首页中文的处理方法

python实现倒计时的示例

python解析json实例方法

c++生成dll使用python调用dll的方法

Python下singleton模式的实现方法

精品推荐
分类导航