python 搜索匹配文件目录下所有的jpg或者png图片
import glob PATH_TO_TEST_IMAGES_DIR = 'D:\TrainChangeFifteenData\Picture\Test' for pidImage in glob.glob(PATH_TO_TEST_IMAGES_DIR + "/*.[jp][pn]g"): print(pidImage)
也就写成"/*.??g"或者"/*.*g",这2种写法可能搜索范围更大,更容易出错
import glob PATH_TO_TEST_IMAGES_DIR = 'D:\TrainChangeFifteenData\Picture\Test' for pidImage in glob.glob(PATH_TO_TEST_IMAGES_DIR + "/*.[jp][pn]g"): print(pidImage)
也就写成"/*.??g"或者"/*.*g",这2种写法可能搜索范围更大,更容易出错