首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > perl python >

python调用 linux系统调用解决方案

2013-10-25 
python调用 linux系统调用为什么我 百度 python调用 linux系统调用 什么都木有呢? 请问有没有 现成的包。

python调用 linux系统调用

为什么  我 百度 "python调用 linux系统调用" 什么都木有呢?
 请问有没有 现成的包。可以用。

 当然 我知道自己 python 调用 C的 .so..然后把每个要用的  系统调用封一下。就行。
 有木有直接用 的 方法。。3Q。。
[解决办法]
ctypes模块。

教程:http://python.net/crew/theller/ctypes/tutorial.html
例子:

/tmp/ python
Python 2.7.5+ (default, Sep 17 2013, 15:31:50) 
[GCC 4.8.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes
>>> libc = ctypes.CDLL("libc.so.6")
>>> libc.printf("Hello, %s\n", "world")
Hello, world
13

热点排行