Python判断文件夹是否为空

# encoding:utf-8
import os

def search(path):
if os.listdir(path):#判断文件夹是否为空 print( os.listdir(path) )#打印文件夹内容 else: print('Sorry,这是一个空文件夹.') path = input('输入一个绝对路径:') search(str(path))

 

 

posted @ 2022-11-10 15:10  CGRun  阅读(1372)  评论(0编辑  收藏  举报