获得“预期的声明”其他:
我曾尝试用elif替换它,但不能解决问题,到目前为止,没有任何在线方法对我有所帮助。
如果我不输入任何其他搜索结果,应该只打印错误消息变量。
if Cmdbar() == "Help":
os.system('cls')
print(colored(logo, 'blue'))
for ItemClassesx in ItemClasses:
print(colored(ItemClassesx, 'green'))
Cmdbar()
elif Cmdbar() == "Longswords":
os.system('cls')
print(colored(logo, 'blue'))
for Longswordsx in Longswords:
print(colored(Longswordsx, 'green'))
Cmdbar()
else:
print(error)
其他块不能保持为空。它必须至少包含“ pass”。
'print(error)'行必须在else块内缩进。
还必须在小数点处缩进您的'Cmdbar()'。