老是记不住唉
import os
path = "3/8622471e46b3821bf87bdff3cbf5380bbd1e8835.jpg" #文件
dir_path = "3" #文件夹
if not os.path.isdir(dir_path):
print("no exist")
else:
print("yes")
if os.path.exists(path):
print("exist!")
else:
print("no")
老是记不住唉
import os
path = "3/8622471e46b3821bf87bdff3cbf5380bbd1e8835.jpg" #文件
dir_path = "3" #文件夹
if not os.path.isdir(dir_path):
print("no exist")
else:
print("yes")
if os.path.exists(path):
print("exist!")
else:
print("no")