[英]How to check whether a folder is empty or not using python?
How can i ckeck wether a folder is empty or not using python?我如何使用 python 检查文件夹是否为空? I'm creating a face recognition program in opencv and i need to check wether the folder where the testing image should be is empty ot not.我正在 opencv 中创建人脸识别程序,我需要检查测试图像所在的文件夹是否为空。 Any help will be appreciated!任何帮助将不胜感激! Ty泰
I'd do我会做
if len(os.listdir(’path/to/your/folder’)) == 0:
print("empty")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.