how to run a .py program in terminal code example
Example 1: how to run python in terminal
#For Python 3:
$ python3 helloworld.py
#For Python 2:
$ python helloworld.py
Example 2: how to run mac terminal from python script
from applescript import tell
#set what command you want to run here
yourCommand = 'ls'
tell.app( 'Terminal', 'do script "' + yourCommand + '"')