python - sys.exit(0) 和 os._exit(0) 有什么区别

标签 python

请帮助我澄清这两个 python 语句在功能差异方面的概念:

  1. sys.exit(0)

  2. os._exit(0)

最佳答案

根据documentation :

os._exit():

Exit the process with status n, without calling cleanup handlers, flushing stdio buffers, etc.

Note The standard way to exit is sys.exit(n). _exit() should normally only be used in the child process after a fork().

关于python - sys.exit(0) 和 os._exit(0) 有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9591350/

相关文章:

python - 在Python中绘制单色bmp格式

python - 从与外键相关的模型中获取数据

python - tensorflow 1.3 和 1.4 之间的 tf.contrib.layers.fully_connected() 行为变化是一个问题吗?

python - Odoo 8 从向导打开 TreeView

python - 如何直接从 Python 使用 Alpha Vantage API

python - 如何使用 Numpy 获取列表的总和及其乘积

python - 第 8 行 : 'crsf_token' , 上的无效 block 标记应为 'endblock'。您是否忘记注册或加载此标签?

python - 不同的字典共享同一个实例

python - Pyperclip 报错

python - 如何在 PyMongo 中索引已知字段的未知字段?