sys.exit() and SystemExit : Sys : Buildin Module PYTHON TUTORIALS


PYTHON TUTORIALS » Buildin Module » Sys »

 

sys.exit() and SystemExit


#!/usr/bin/env       python

import sys

def usage():
    print 'At least arguments (incl. cmd name).'
    print 'usage: args.py arg1 arg2 [arg3... ]'
    sys.exit(1)

argc = len(sys.argv)
if argc < 3:
    usage()
print "number of args entered:", argc
print "args (incl. cmd name) were:", sys.argv



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo Buildin Module
» Sys