from numpy import *
a1 =[[1,2,3],[4,5,6]]#串列
a2= array(a1) #陣列
a2
array([[1,2,3],[4,5,6]])
a3=mat(a1) #矩陣
a3
matrix([[1,2,3],
[4,5,6]])
#python tolist()方法是將陣列或者矩陣轉換成串列
a4=a2.tolist() #將陣列轉換成串列
a4
[1,2,3],[4,5,6]#串列
a5=a3.tolist()#將矩陣轉換成串列
a5
[1,2,3],[4,5,6]
a4=a5
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/107895.html
