How to iterate over multiple lists at once?

I have a bit of a puzzle here what I want to do is have a "for in", which includes the three variables from the .POST request and request.FILES that I did:

images = request.FILES.getlist('image')
titles = request.POST.getlist('title')
captions = request.POST.getlist('caption')
for image,title,caption in images,titles,captions:

which doesn't seem to work any solutions?

+3
source share
1 answer
for image, title, caption in zip(images, titles, captions):

.. Is this what you want. ( zip docs )

+17
source

All Articles