矩阵转列表

矩阵转列表

from numpy import *
a =  mat([[1,34,3],[2,3,41],[2,34,41],[2,53,41]])
print(a.flatten())
print(a.flatten().A)
#矩阵转为列表
print(a.flatten().A[0])
'''
[[ 1 34  3  2  3 41  2 34 41  2 53 41]]
[[ 1 34  3  2  3 41  2 34 41  2 53 41]]
[ 1 34  3  2  3 41  2 34 41  2 53 41]
'''


欢迎关注我的公众号:小秋的博客 CSDN博客:https://blog.csdn.net/xiaoqiu_cr github:https://github.com/crr121 联系邮箱:rongchen633@gmail.com 有什么问题可以给我留言噢~
原文地址:https://www.cnblogs.com/flyingcr/p/10327036.html