how to run a C code with argc argv from python? -


i need run c code python, adviced here , works perfectly:

from subprocess import call call(["./code", "args", "to", "code"]) 

i run code in order run needs argv, number, instance shell should call simply:

./code #certainnumber 

i pass string @ call function, like:

d=1 str = "./code %d"(%d) call([str, "args", "to", "code"]) 

obviously not work. chose python parameter need insert in c code.

thanks

as twalberg said works perfectly:

call(["./code", str(variablecontainingnumber), "other", "args"]) 

Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -