小编use*_*182的帖子

这个错误是什么意思:“TypeError:泛型类型的参数必须是类型”?

我不确定这个错误是什么意思:

TypeError: Parameters to generic types must be types. Got slice(typing.List, <class 'int'>, None).
Run Code Online (Sandbox Code Playgroud)

我试图确认矩阵中是否有给定的单元格/索引。(在矩阵中[[A, B, C], [D, E, F]]是否[0, 2]存在单元格/索引?在 C 处是)。

我的输入参数是一个指定单元格索引的列表。我想获取单元格/列表并修改它以检查它是否存在。每次我尝试触摸参数列表时,都会出现错误。

def in_matrix(matr: List[List:int], cell: List[int]) -> bool:
    b = cell.pop()
    a = cell.pop()
    print(a)
    print(b)
    for y in range(len(matr)):
        for x in range(len(matr[y])):
            if matr[a][b] == True:
                return True
            else:
                return False
Run Code Online (Sandbox Code Playgroud)

python typeerror python-3.x

12
推荐指数
1
解决办法
1万
查看次数

标签 统计

python ×1

python-3.x ×1

typeerror ×1