用Python遍历C盘dll文件的方法

Diane ·
更新时间:2024-09-21
· 708 次阅读

python 的fnmatch 还真是省心,相比于 java 中的FilenameFilter ,真是好太多了,你完成不需要去实现什么接口。

fnmatch 配合 os.walk() 或者 os.listdir() ,你能做的事太多了,而且用起来相当 easy。

# coding: utf-8 """ 遍历C盘下的所有dll文件 """ import os import fnmatch def main(): f = open('dll_list.txt', 'w') for root, dirs, files in os.walk('c:\\'): for name in files: if fnmatch.fnmatch(name, '*.dll'): f.write(os.path.join(root, name)) f.write('\n') f.close() print 'done...' if __name__=='__main__': main()</pre>


您可能感兴趣的文章:python引用DLL文件的方法Python获取DLL和EXE文件版本号的方法c++生成dll使用python调用dll的方法Python 调用DLL操作抄表机Python 调用VC++的动态链接库(DLL)python调用Delphi写的Dll代码示例



用python dll 方法 dll文件 Python

需要 登录 后方可回复, 如果你还没有账号请 注册新账号
相关文章