Need better way to unpack a list

Nx nomail at nomail.com
Wed Aug 17 09:27:20 EDT 2005


> for index, value in enumerate(mylinelist):
> getattr(self, "line%d" % (index + 1)).setText(value)

Thanks ! This was the line which did it ....
The correct code snippet now reads :

# set the lineedits of the QT gui
for index,value in enumerate(self.mylinelist):
   getattr(self, "lineEdit%d" % (index + 1)).setText(self.tr(value))


Nx



More information about the Python-list mailing list