且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

相当于MATLAB冒号运算符的Python

更新时间:2022-01-15 15:28:38

@karakfa是正确的,因为这是创建简单列表的方式.

@karakfa is right in that this is the way to create a simple list.

Matlab的向量和矩阵提供向量化的计算,如果这是您需要的,则可能应该使用numpy.array:

Matlab's vectors and matrices offer vectorised computation, though, and if that's what you need, you should probably use numpy.array:

>>> import numpy
>>> numpy.arange(1, 11)
array([ 1,  2,  3,  4,  5,  6,  7,  8,  9, 10])