Contact: aviboots(AT)netvision.net.il
39,928 questions
51,861 answers
573 users
lst1 = [1,2,3,4] lst2 = [5,6,7,8] import numpy as np matrix = np.column_stack((lst1, lst2)) print(matrix) ''' run: [[1 5] [2 6] [3 7] [4 8]] '''
lst1 = [1,2,3,4] lst2 = [5,6,7,8] matrix = [] for i in range(len(lst1)): matrix.append([lst1[i], lst2[i]]) print(matrix) ''' run: [[1, 5], [2, 6], [3, 7], [4, 8]] '''