[英]What is the difference between [1,2,3] and array([1,2,3])
I am learning python and I find a=[1,2,3] is almost the same as a=array([1,2,3]),though the latter will show [1 2 3] when I print it. 我正在学习python,我发现a = [1,2,3]与a = array([1,2,3])几乎相同,尽管在我打印时后者会显示[1 2 3]。 What is the difference between them?
它们之间有什么区别?
The first is a Python list and the second is, presumably a numpy array. 第一个是Python列表,第二个大概是一个numpy数组。 numpy arrays have drastically different features than lists: lists are easily expanded and contracted 1d vectors of arbitrary Python objects.
numpy数组的功能与列表完全不同:列表易于扩展和收缩任意Python对象的1d向量。 numpy arrays are memory-compact representations of mostly numbers of arbitrary dimension and fixed size, mainly for use with numerical programming.
numpy数组是紧凑的表示形式,主要表示任意维数和固定大小的数字,主要用于数值编程。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.