How to get matrix transform in python Posted on 2021-01-04 Edited on 2023-07-24 In Python Here is a special trick: 1234567>>> a = [[1,2,3],[4,5,6],[7,8,9]]>>> a[[1, 2, 3], [4, 5, 6], [7, 8, 9]]>>> zip(*a)<zip object at 0x7fadf143f780>>>> list(zip(*a))[(1, 4, 7), (2, 5, 8), (3, 6, 9)]