【发布时间】:2020-08-31 17:28:03
【问题描述】:
我在下面使用此代码,但它只输出“TypeError:第一个参数必须是可调用的”
import atexit
def end_script():
print("ahh yes it works")
atexit.register(end_script())
while True:
print("It still doesn't work")
atexit.register(x) 不应该只在脚本关闭时调用 x 吗? 我得到的所有参考都令人困惑,所以我有点迷失在这里。
【问题讨论】:
标签: python-3.x atexit