如何正确遍历2D数组?

时间:2018-11-23 06:02:22

标签: python-3.x

我有以下代码:

matrix = [[0 for x in range(26)] for y in range(26)]
for i in range(26):
    for j in range(26):
        matrix[i][j] = ...

此代码实际上有效,但是'matrix [i] [j]'中的'j'总是会警告我:

Unexpected type(s): (int, float) Possible types: (int, int) (slice, Iterable[int]) less... (Ctrl+F1) 
Inspection info: This inspection detects type errors in function call expressions. Due to dynamic dispatch and duck typing, this is possible in a limited but useful number of cases. Types of function parameters can be specified in docstrings or in Python 3 function annotations.

有人可以告知为什么会发生这种情况以及如何解决吗?谢谢。

顺便说一句,我使用PyCharm社区2018.2。

0 个答案:

没有答案