list转换为array:
np.array(list_name)
array 转换为list:
array_name.tolist()
区别:
array可以用.shape查看规模 list没有该特性
list有+,append,extend等特性 而且之间区别很大,要注意 具体看代码
![](https://img.haomeiwen.com/i14484495/0b02f1c0fbf0e1a4.png)
![](https://img.haomeiwen.com/i14484495/2d83c4a0b65a996a.png)
![](https://img.haomeiwen.com/i14484495/6c22b0f77941467e.png)
时间原因 赶着写项目 先写这么多,有时间再添加
list转换为array:
np.array(list_name)
array 转换为list:
array_name.tolist()
区别:
array可以用.shape查看规模 list没有该特性
list有+,append,extend等特性 而且之间区别很大,要注意 具体看代码
时间原因 赶着写项目 先写这么多,有时间再添加
本文标题:python list和array的区别与转换
本文链接:https://www.haomeiwen.com/subject/frtazftx.html
网友评论