January 9th, 2005, 12:02 PM
You could import the sys module and call sys.exit() although by far my favorite way to exit a program is by raising 'SystemExit'.
Python 2.4 (#1, Dec 10 2004, 19:59:18)
[GCC 3.3.3 (SuSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> userName = 'Mark'
>>> if userName == 'Mark':
... raise SystemExit
This is amazingly simple, and if you know how to use/handle exceptions in Python then it can be surprisingly powerful