首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >将字符串列表从python/ctype传递到C函数,应为char **

将字符串列表从python/ctype传递到C函数,应为char **
EN

Stack Overflow用户
提问于 2010-08-16 23:24:07
回答 4查看 11.3K关注 0票数 24

我有一个C函数,它需要一个list \0结尾的字符串作为输入:

void external_C( int length , const char ** string_list) { 
   // Inspect the content of string_list - but not modify it.
} 

在python (带有ctype)中,我想根据python字符串的列表调用此函数:

def call_c( string_list ):
    lib.external_C( ?? )

call_c( ["String1" , "String2" , "The last string"])

关于如何在python端构建数据结构,有什么建议吗?注意,我保证C函数不会改变string_list中字符串的内容。

问候

joakim

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3494598

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档