V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
ivito
V2EX  ›  Python

Python 如何实现系统调用

  •  
  •   ivito ·
    fireboyvt · 2015-07-24 20:15:59 +08:00 · 2902 次点击
    这是一个创建于 3200 天前的主题,其中的信息可能已经有所发展或是发生改变。
    Python可以调用系统的很多功能是不争的事实,比如创建文件,比如网络通信。
    那python对系统的系统调用是如何实现的呢,是通过c语言编写的模块呢(Cython中)还是通过某一个bytecode做的呢?
    如果是通过c语言编写的模块,那么python是如何调用c函数的呢?
    6 条回复    2015-07-26 12:46:44 +08:00
    Septembers
        1
    Septembers  
       2015-07-24 20:16:34 +08:00
    ctypes?
    noli
        2
    noli  
       2015-07-24 20:54:23 +08:00
    通过搜索引擎搜 Python C 就有答案了。无论是百度还是 Google 都有。
    lululau
        3
    lululau  
       2015-07-24 21:03:53 +08:00
    qw7692336
        4
    qw7692336  
       2015-07-25 06:01:35 +08:00
    为什么没有人把系统调用封装成python呢?
    kinghui
        5
    kinghui  
       2015-07-25 09:50:14 +08:00
    ivito
        6
    ivito  
    OP
       2015-07-26 12:46:44 +08:00
    @lululau 感谢回答,看来Python是把系统API封装成os模块了,那Python调用os模块的c编写的函数与调用py编写的函数有什么不同呢?

    @kinghui 这是提供给开发者的API,跟我提问的如何调用系统函数不是一回事啊
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1657 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 16:38 · PVG 00:38 · LAX 09:38 · JFK 12:38
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.