Answers for "execute python script from python"

2

python execute shell command and get output

import subprocess
process = subprocess.Popen(['echo', 'More output'],
                     stdout=subprocess.PIPE, 
                     stderr=subprocess.PIPE)
stdout, stderr = process.communicate()
stdout, stderr
Posted by: Guest on March-07-2020
12

run python file using python code

exec(open('file.py').read())
Posted by: Guest on May-24-2020
3

how to execute bash commands in python script

import subprocess
subprocess.call(["sudo", "apt", "update"])
Posted by: Guest on November-17-2019
-2

how to execute a python script

C:Python27python.exe C:UsersUsernameDesktopmy_python_script.py
Posted by: Guest on January-29-2021

Code answers related to "execute python script from python"

Python Answers by Framework

Browse Popular Code Answers by Language