import os
def findFile(path):
files=os.listdir(path) #查找路径下的所有的文件夹及文件
for filee in files:
f=str(path+filee) #使用绝对路径
if os.path.isdir(f): #判断是文件夹还是文件
if not os.listdir(f): #判断文件夹是否为空
print(str(filee))
else:
print('f',f)
if __name__ =='__main__':
path = input('input_path:') #raw_input 函数数从命令输入
findFile(str(path))
利用python判断路径下文件夹是否为空
最新推荐文章于 2024-08-07 03:46:26 发布