我用的 pycharm 想在停止程序时执行一段代码,类似 winform 的 formClosing
我的程序中 有 while True
试过import atexit
@atexit.registerdef clean():print('完了')
没有执行
程序能执行