execute terminal command in python code example
Example 1: execute command in python script
import os
os.system("ma Commande")
os.system("cd Documents")
Example 2: python how to run terminal command
import os
os.system("ls -l")
Example 3: how to run python in terminal
$ python3 helloworld.py
$ python helloworld.py
Example 4: python run shell command
sudo apt-get install python
sudo apt-get install python3
python /path-to-file/pyfile.py
python3 /path-to-file/pyfile.py
python /home/person/randomfile.py
python3 /home/person/randomfile.py