python写一个代码,将行向量转换为列向量并按列拼接

定义列表list_1和list_2

list_1 = [1,2,3] list_2 = [4,5,6]

将行向量转换为列向量

column_1 = [row[i] for row in list_1 for i in range(len(list_1))] column_2 = [row[i] for row in list_2 for i in range(len(list_2))]

按列拼接

column_merged = column_1 + column_2

输出拼接后的列向量

print(column_merged)

猜你喜欢

转载自blog.csdn.net/weixin_42590539/article/details/129597816