@ Introducing Python: Modern Computing in Simple Packages by Bill Lubanovic (No. 2351 / 12833)
There is an example of making a table using comprehension notation.
http://ideone.com/QJqVpn
rows = range(1,4)
cols = range(1,3)
cells = [(row, col) for row in rows for col in cols]
for cell in cells:
print(cell)
result
Success time: 0 memory: 23968 signal:0
(1, 1)
(1, 2)
(2, 1)
(2, 2)
(3, 1)
(3, 2)
(Addition 2017/03/24)
@ shiracamus's Comment taught me how to use itertools.
Thank you for the information.
Recommended Posts