ctypes 使用
import ctypes # 加载C库 lib = ctypes.CDLL('./libexample.so') # 调用C函数 result = lib.add(3, 4) print(result)
Cython 基础
# example.pyx def fibonacci(int n): cdef int a = 0, b = 1, i for i in range(n): a, b = b, a + b return a
转载请注明:周志洋的博客 » Python进阶-C扩展开发