mat = [[0, 1, 2, 3, 4],
[10, 11, 12, 13, 14],
[20, 21, 22, 23, 24],
[30, 31, 32, 33, 34],
[40, 41, 42, 43, 44]]
mat_de_lhorloger = list(zip(*reversed(mat)))
EDIT: Accessoirement,
def checkMatrix(matrix):
from itertools import zip_longest
return len(matrix) == len(list(zip(*matrix))) == len(list(zip_longest(*matrix)))
Message édité par _iOn_ le 15-01-2011 à 21:24:13
---------------
Any sufficiently complex bug is indistinguishable from magic.