Python 如何从文件夹中加载多个图像。PyQt4
我希望能够从给定的文件夹中逐个加载大量图像。而且不知道每个图像的名称(仅知道所有图像所在文件夹的名称)。目前,我只能使用其名称(pic.jpg)加载一个图像:Python 如何从文件夹中加载多个图像。PyQt4,python,image,pyqt4,Python,Image,Pyqt4,我希望能够从给定的文件夹中逐个加载大量图像。而且不知道每个图像的名称(仅知道所有图像所在文件夹的名称)。目前,我只能使用其名称(pic.jpg)加载一个图像: 有没有办法做到这一点?提前谢谢 操作系统模块包含文件系统访问功能 import os dir = "dirname" for file in os.listdir(dir): ... = QtGui.QPixmap(os.path.join(dir, file)) 注意:os.path.join在那里,因此您不知道平台 impo
有没有办法做到这一点?提前谢谢 操作系统模块包含文件系统访问功能
import os
dir = "dirname"
for file in os.listdir(dir):
... = QtGui.QPixmap(os.path.join(dir, file))
注意:os.path.join在那里,因此您不知道平台
import os
dir = "dirname"
for file in os.listdir(dir):
... = QtGui.QPixmap(os.path.join(dir, file))