我已经定义了一个函数,它会根据它的值打印一个特定的字符串。但是,我收到一条错误消息,指出global name 'must_print' is not defined.
这是我的代码:
def myfunction(must_print):
must_print = True
if bool(must_print) == True:
print("Done")
elif bool(must_print) == False:
print("Change value")
if __name__ == "__main__":
myfunction(must_print)
你知道我为什么会收到这个错误吗?
喵喵时光机
梵蒂冈之花
相关分类