Führen Sie den Befehl im Python -Skript aus
import os
os.system("ma Commande")
#Exemple:
os.system("cd Documents")
Cheerful Caracal
import os
os.system("ma Commande")
#Exemple:
os.system("cd Documents")
In the file job.sh, put this
#!/bin/sh
python python_script.py
Execute this command to make the script runnable for you : chmod u+x job.sh
Run it : ./job.sh
import subprocess
output = subprocess.check_output('pidstat -p ALL'.split(' '), stderr=subprocess.STDOUT, universal_newlines=True)
print(output)
import subprocess
subprocess.call(["./shell.sh"])
# Make sure that "shell.sh" has "+x" permissions