Q:

python execute shell command

import os
os.system('cmd /k "Your Command Prompt Command"')
3
import os

os.system("ma Commande")

#Exemple:

os.system("cd Documents")
3
import os
cmd = "git --version"
returned_value = os.system(cmd)  # returns the exit code in unix
3
import os

os.system("javac lolol.java")# or something....
5
import subprocess
subprocess.call(["./shell.sh"])

# Make sure that "shell.sh" has "+x" permissions
1
python3 yourcode.py

or

python yourcode.py
0

New to Communities?

Join the community