Home > Q&A > body text
PHP中文网2017-04-18 09:24:05
There is a standard solution for this, which iszip:
zip
>>> l1 = ['a', 'b', 'c'] >>> l2 = ['x', 'y', 'z'] >>> l3 = zip(l1, l2) >>> l3 [('a', 'x'), ('b', 'y'), ('c', 'z')]
Then you can just loop over l3 in the template.