views:

93

answers:

2

My code:

def main():
    usage = "usage: %prog [options] arg"
    parser = OptionParser(usage)
    parser.add_option("-p", "--pending", action="callback", callback=pending, type="string", dest="test", help="View Pending Jobs")
    (options, args) = parser.parse_args()
    if x == 0:
     print usage, " (-h or --help for help)"
    print options.test

if i had: script -p hello

i need options.test to print out the argument as type string

A: 

Ended up passing the argument to the function that is being called.

A: 

The arguments are available through sys.argv.

jldupont