This question already has answers here:
Extract first item of each sublist
                                
                                    (7个答案)
                                
                        
                                2年前关闭。
            
                    
如何在Python中将矩阵中的列转换为列表?
例如。
兑换

test = [['Student','Ex1','Ex2','Ex3'],['Thorny','100','90','80'],['Mac','100','90','80'],['Farva','100','90','80']]




Student = ['Thorny','Mac','Farva']


请指教。

最佳答案

Student = list(zip(*test))[0][1:]

where

>>>list(zip(*test))

[('Student', 'Thorny', 'Mac', 'Farva'),
 ('Ex1', '100', '100', '100'),
 ('Ex2', '90', '90', '90'),
 ('Ex3', '80', '80', '80')]

10-06 11:16