比如你的C文件是c_functions.c:
内容如下:normal_1(in-1,
in-2,
in-3)
{
;
}
normal_2()
{
;
}
程序参考源码:import re
f = open('c_functions.c')
c_functions = ''.join(f.readlines())
f.close()
print c_functions
print '-' * 30
fun_name = 'normal_1'
temp_str = re.findall(r'normal_1\((.*?)\)',c_functions,re.DOTALL)[0]
args = re.sub(r'\s','',temp_str).split(',')
print fun_name
print args
输出:
normal_1(in-1,
in-2,
in-3)
{
;
}
normal_2()
{
;
}
------------------------------
normal_1
['in-1', 'in-2', 'in-3']
[Finished in 0.2s]