run python file with code example
Example 1: run python file using python code
exec(open('file.py').read())
Example 2: how to execute a python script
C:\Python27\python.exe C:\Users\Username\Desktop\my_python_script.py
exec(open('file.py').read())
C:\Python27\python.exe C:\Users\Username\Desktop\my_python_script.py