import os test_path ="/Users/yxk/Desktop/test/GrayScale.tif"
if(os.path.exists(test_path)):print('文件存在!!!!')
else:print("文件不存在!!!!")
結果如下
代碼
import os test_path ="/Users/yxk/Desktop/testA/GrayScale.tif"
if(os.path.exists(test_path)):print('文件存在!!!!')
else:print("文件不存在!!!!")