1.利用pathlib 中的Path import os from pathlib impot Path path= './image' paths = list(Path(path).glob('*')) for in in paths: print(i.name) # 打印文件名