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
Post a Comment