如何在循环中更改变量名而不使用列表或数组。我正在使用pyqt5开发dekstop应用程序。你知道吗
我有图像文件的标签,像这样:image1,image2,image3。。。你知道吗
def click_facecrop(self):
shutil.copy2(filename, './u_image.jpg')
myImage = SImage('u_image.jpg')
myImage.face_multiple_crop_from_image('testcrop')
files = glob.glob("./testcrop/*.jpg")
for file in files:
try:
print str(file)
p_map = QPixmap(file)
#this image1 must change in while loop like image2,image3...
self.image1.setScaledContents(True)
self.image1.setPixmap(p_map)
except:
pass
如果要在self上获取属性,可以使用函数
getattr
。你知道吗相关问题 更多 >
编程相关推荐