Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/visual-studio-code/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Pylint:意外的缩进错误--用于循环_Python_Visual Studio Code - Fatal编程技术网

Python Pylint:意外的缩进错误--用于循环

Python Pylint:意外的缩进错误--用于循环,python,visual-studio-code,Python,Visual Studio Code,我尝试了几种不同的缩进“样式”,但VSCode坚持认为第70行附近存在缩进错误 对于记录,identifier语句和下面的所有语句都缩进到IDE中 for node in nodes: identifier = node['id'] group = node['group'] # Checking if the node is immediately related to the viewer if (group == viewer_group): note = {'source': i

我尝试了几种不同的缩进“样式”,但VSCode坚持认为第70行附近存在缩进错误


对于记录,identifier语句和下面的所有语句都缩进到IDE中

for node in nodes:
identifier = node['id']
group = node['group']
# Checking if the node is immediately related to the viewer
if (group == viewer_group):
    note = {'source': identifier,
VSCode快照:

在for之后需要缩进,直到循环结束

for node in nodes:
    identifier = node['id']
    group = node['group']
    # Checking if the node is immediately related to the viewer
    if (group == viewer_group):
        note = {'source': identifier, 

# code after loop
...

在for之后需要缩进,直到循环结束

for node in nodes:
    identifier = node['id']
    group = node['group']
    # Checking if the node is immediately related to the viewer
    if (group == viewer_group):
        note = {'source': identifier, 

# code after loop
...

“不同的缩进样式”。。?
后面应该有一个缩进,用于…:
。第70行是什么?for语句是第70行。在VSCODE/IDLE中,所有语句排列在“节点”(1个制表符缩进)下面,这里是语法示例。如果没有适当的缩进,您就不能真正说出
for
循环中的内容。“对于记录,identifier语句和下面的所有语句都缩进到IDE中。”-为什么您没有在问题中复制它?“不同的缩进“样式”。。?
后面应该有一个缩进,用于…:
。第70行是什么?for语句是第70行。在VSCODE/IDLE中,所有语句排列在“节点”(1个制表符缩进)下面,这里是语法示例。如果没有适当的缩进,您就不能真正说出
for
循环中的内容。“对于记录,identifier语句和下面的所有语句都缩进到IDE中。”-以及为什么您在问题中没有在这里复制这些内容?还可能需要注意,保持一致性很重要。也就是说,缩进可以使用制表符,也可以使用空格,但不要同时使用两者。我个人建议使用4个空格进行缩进。我可能还想指出,保持一致性很重要。也就是说,缩进可以使用制表符,也可以使用空格,但不要同时使用两者。我个人建议使用4个空格进行缩进。