是否有 ipython 服务器预关闭挂钩?

Is there a ipython server pre shutdown hook?

我想 运行 一小段 python 笔记本服务器收到关闭信号时的代码,配置中有这个钩子吗?

我不认为有什么 IPython 具体的。您可以在 Python 解释器退出之前使用 atexit 模块 (https://docs.python.org/2/library/atexit.html) 运行 代码。