注册 登录
编程论坛 Python论坛

该如何正确应用U.shape(-1)?

deli123 发布于 2019-05-05 20:52, 1517 次点击
U = np.float64(U)
        if (U.ndim != 1 and U.shape[-1] != self.nu):

其中 U.shape[-1]报错,Value 'U.shape' is unsubscriptablepylint(unsubscriptable-object)
如果改成 U.shape(-1)报错,Too many positional arguments for method call

环境 Anaconda python 3.7.3

该如何正确应用U.shape(-1)
1 回复
#2
deli1232019-05-05 21:17
定义 U = np.zeros((n*3, 2))
1