|
发表于 2021-1-24 08:48:53
|
显示全部楼层
本楼为最佳答案
本帖最后由 suchocolate 于 2021-1-24 09:10 编辑
不知道你说的是什么方面的shape函数,如果是numpy,numpy.shape(a)返回的是a的纬度。- >>> import numpy as np
- >>> ls1 = [1,2,3,4,5]
- >>> np.shape(ls1)
- (5,)
- >>> ls2 = [[1,2,3,4,5],[6,7,8,9,10]]
- >>> np.shape(ls2)
- (2, 5)
- >>>
- >>> help(np.shape)
- Help on function shape in module numpy:
- shape(a)
- Return the shape of an array.
-
- Parameters
- ----------
- a : array_like
- Input array.
-
- Returns
- -------
- shape : tuple of ints
- The elements of the shape tuple give the lengths of the
- corresponding array dimensions.
复制代码
这些基本的东西看教程吧。https://www.runoob.com/numpy/numpy-tutorial.html |
|