FileNotFoundError: [Errno 2] No such file or directory: 'PNG'

python中要使用 files = os.listdir('./path')  获得当前目录下,path文件夹中的所有文件,  会发现获得的文件的绝对路径是属于当前文件夹而不是path文件夹下,  要获得正确的绝对路径,需要在遍历中加入file  = os.path.join('./path', file)

猜你喜欢

转载自blog.csdn.net/m0_37827405/article/details/82251295
今日推荐