Home > other >  Python tolist method
Python tolist method

Time:10-03

The from numpy import *
A1=[[1, 2, 3], [4 and 6]] # list
A2=array (a1) # array
A2
Array ([[1, 2, 3], [4 and 6]])
A3=mat (a1) # matrix
A3
Matrix ([[1, 2, 3],
[4 and 6]])
# python tolist () method is an array or matrix into a list
A4=a2. # tolist () to convert an array to list
A4
[1, 2, 3], [4 and 6] # list
A5=a3. Tolist () # transform matrix into a list
A5
[1, 2, 3], [4 and 6]
A4=a5

  • Related