python获取文件夹里指定后缀的文件
`import os, sys
def find_file(file,path):
# 获取文件夹得
file_list = os.listdir(path)
# 打开一个文件对象
f = open("C:\Users\mt\Desktop\"+file+".txt","w")
# 循环输出
for i in file_list:
# 如果符合条件则添加进入.TXT
if i.endswith(file):
f.write(i+'\n')
if name == "main":
# 输入要获取的文件夹路径
path = "C:\Windows\System32"
# 输入要获取文件的后缀名字
file = "dll"
find_file(file,path)
`

浙公网安备 33010602011771号