1、glob
使用glob.glob获得文件路径
import glob
imgsPath='test'
images=glob.glob(imgsPath+'/*') #获得imgsPath下所有的文件路径
print(images)
2、os.path.isdir()和os.path.isfile()
os.path.isdir()用于判断某一对象是否为目录(需提供绝对路径)
os.path.isfile()用于判断某一对象是否为文件(需提供绝对路径)
1、glob
使用glob.glob获得文件路径
import glob
imgsPath='test'
images=glob.glob(imgsPath+'/*') #获得imgsPath下所有的文件路径
print(images)
2、os.path.isdir()和os.path.isfile()
os.path.isdir()用于判断某一对象是否为目录(需提供绝对路径)
os.path.isfile()用于判断某一对象是否为文件(需提供绝对路径)