首页 > 解决方案 > Cython,调用 shell 命令。性能提升

问题描述

我的问题很简单。使用 Cython 与纯 Python 调用 shell 命令或操作系统上存在的任何其他二进制可执行文件有什么好处吗?

标签: pythoncython

解决方案


而不是os.system()? 并不真地。

的实现os.system()基本上是(删除了一些宏):

static long
os_system_impl(PyObject *module, const Py_UNICODE *command)
{
    long result;

    if (PySys_Audit("os.system", "(u)", command) < 0) {
        return -1;
    }

    result = _wsystem(command);
    return result;
}

推荐阅读