变量定义错误

2024-04-20 00:09:51 发布

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

运行此代码时遇到问题。这是我收到的错误

Traceback (most recent call last): File "C:\Windows\System32\python test 1.py", line 53, in counter_c + 1

NameError: name 'counter_c' is not defined

我认为python将其解释为字符串或布尔值。有人有什么建议吗?你知道吗

这是我的密码:

while (True == end_command):

    c_l_i = input(">>: ")

    for mlist in master_list:

        inList = ['help', 'other_help']

        if (c_l_i in eval (mlist)):

            counter_c = 0

            inList[0] = "true"

            counter_c + 1

            print (inList)

            #find_in(c_l_i)

        else:

            inList[0] = "false"

            counter_c + 1

            print (inList)

print (inList)

Tags: 代码inmostwindows错误counterhelpcall