Stopping a program

Thomas Philips tkpmep at hotmail.com
Sun Feb 15 19:00:02 EST 2004


I'd like to stop a program (i.e. terminate its execution) without
raising an exception if some condition is met, e.g

answer = " "
while answer not in "yn":
    answer = raw_input("y for yes, n for no, enter to exit ")
    if answer == ""
       stop/quit/end/whatever it takes to terminate the program
    elif answer == "y"
      #Yes
      .
      . 
    elif answer == "n"
      #No
      .
      . 

In Fortran, I'd use a stop command to do this. What is the appropriate
equivalent in Python?

Thomas Philips



More information about the Python-list mailing list