What command should be use when the testing of arguments is failed?

Peng Yu pengyu.ut at gmail.com
Wed Oct 14 20:53:03 EDT 2009


I have the following python code snippet. I'm wondering what command I
should use to terminate the program if the arguments are not right.

#!/usr/bin/env python

import sys
import os

if len(sys.argv) <= 1:
  print "usage:", os.path.basename(sys.argv[0]), '<something>'
  return ## what command should be used here to terminate the program?



More information about the Python-list mailing list