Using python in terminal on a Mac, type
ctrl-z
will stop the python, but not exit it, giving output like this:
>>>
CTRL+d -> Defines EOF (End of File).
CTRL+c -> Will terminate most jobs.
If, however you have written a python wrapper program that calls other python programs in turn, Ctrl-c will only stop the the job that is currently running. The wrapper program will keep running. Worst case scenario, you can do this:
Open up: Applications -> Utilities -> Activity Monitor, Find the process labeled as python, highlight it in the activity monitor then click on "Quit Process".
These three suggestions should work for most situations where you want a program to stop.