Pylint:循环的意外缩进错误

2024-04-19 13:49:04 发布

您现在位置:Python中文网/ 问答频道 /正文

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

对于record-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快照:
VSCode Snapshot


Tags: theinnodeforif错误group样式
1条回答
网友
1楼 · 发布于 2024-04-19 13:49:04

在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
...

相关问题 更多 >