Python 获取文件夹内所有指定格式文件名
import os
path
= r
"C:\Users\Lenovo\Desktop\operate_his_new"
def file_name():
F
= []
for root
, dirs
, files
in os
.walk
(path
):
for file in files
:
if os
.path
.splitext
(file)[1] == '.csv':
t
= os
.path
.splitext
(file)[0]
print(t
)
F
.append
(t
)
return F
file_name
()
转载请注明原文地址: https://yun.8miu.com/read-107975.html