performance - Iterating bidimensional array/list with only one for (Python) -
this question has answer here:
- “for loop” 2 variables? 7 answers
instead of doing this:
for x in range(500): y in range(300): print x,y
how can this?
for x,y in range(500),range(300): print x,y
i use itertools.product
from itertools import product x, y in product(range(500), range(300)): print x, y
Comments
Post a Comment