Home>

Can a program written in python be called and used on a c language program?
If i can, please tell me how to do it.
There is no knowledge about c language.

  • Answer # 1

    You can do this by invoking a Python command using the

    systemfunction.

    system ("full path of python script file");


    Depending on what you want to do with the result of the Python script, you may use a different method.

  • Answer # 2

    A page that might be helpful

    https://qiita.com/SatoshiTerasaki/items/0df5970eebf9e0ab4031


    It would be harsh or reckless without knowledge of the C language.

    The best method depends on what you want to do.

    Preprocess data with python and throw the result to C
    First, run the python program and output it in csv or binary format, then read the file from C

    I just want to run a python program from C
    It can also be called as a system command ()

Related articles