输入list:
>>> import numpy as np
>>> a = [[1,2],[3,4]]
>>> type(a)
<class 'list'>
将list转换为数组:
>>> b = np.array(a)
>>> b
array([[1, 2],
[3, 4]])
>>> type(b)
<class 'numpy.ndarray'>
将数组转换为list:
>>> c = b.tolist()
>>> c
[[1, 2], [3, 4]]
>>> type(c)
<class 'list'>