On 10/03/2010 08:21 PM, Andrew Evans wrote:
I am trying to use two database values returned in my function
If I use two loops (one inside another) it repeats itself for a single
item for how many items are in the database, I think its cause of the
two loops
So I am trying to combine the loops into one
{{for (stuff, products) in (userstuff, product):}}
But I am unsure how to do this
Any ideas
Or is there anyway to use the values in the view with out using a for
loop and looping in general that may be best
*cheers
Use the built-in called zip:
for stuff,product in zip(stuff_list, product_list):
...
Then the two lists will be walked through in lock step.
See http://docs.python.org/library/functions.html for documentation.
--
Gary Herron, PhD.
Department of Computer Science
DigiPen Institute of Technology
(425) 895-4418