K
K
KerroViT2020-07-27 21:15:45
Python
KerroViT, 2020-07-27 21:15:45

How to call an external executable with argument passing from a python function?

Essence of the question. There is a function that takes 3 arguments (2 of which are file paths, and the third is a number), suppose argument1, argument2 and argument3.
For example, you need to call the executable file test.exe to execute the command

test.exe /test argument1 argument2 argument3

How can this be implemented?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Karbivnichy, 2020-07-27
@KerroViT

Look for subprocess. On linux you can do this:

import subprocess
subprocess.run(["ls", "-l", "-a"])

Try to fix it for Windows (now windows is not at hand).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question