Hey guys. I am trying to do something in pyGTk where I am creating a HBoxes list:
self.keyvalueboxes = [] for keyval in range(1,self.keyvaluelen): self.keyvalueboxes.append(gtk.HBox(False, 5))
But then I want to run the list and assign a text entry and label to each of them that are stored in the list.
I'm sorry that I'm not very specific, but if you need more help with what I'm doing, I will help!
Thank!
If your list is of equal length, use zip
>>> x = ['a', 'b', 'c', 'd'] >>> y = [1, 2, 3, 4] >>> z = zip(x,y) >>> z [('a', 1), ('b', 2), ('c', 3), ('d', 4)] >>> for l in z: print l[0], l[1] ... a 1 b 2 c 3 d 4 >>>
Check out http://docs.python.org/library/functions.html#zip . It allows you to iterate over two lists at the same time.
Source: https://habr.com/ru/post/1771829/More articles:When is the App Store promo code valid? - iphoneUsing multiple log4net loggers - log4netHow exactly do I install the restful authentication plugin in rails 3? - ruby-on-railsMagento - javascript reliance = огромные проблемы с удобством использования - javascriptThe shortest route without a destination in Google Maps V3? - javascriptTransition from numpy array to itk Image - pythonadd unique identifier to requests redirected from nginx reverse proxy - clojurexslt конкатенировать текст с узлов - xmlUITableViewCell cellForRowAtIndexPath calls a large number of rows on the first scroll - iosUsing ProGuard with Android. - javaAll Articles