from optparse import OptionParser
def main():
# The entry point : obtain the password and connect database.
parser=OptionParser()
parser.add_option("-p", "--password", dest="input", help="input", metavar="INPUT_VAL")
(options, args) = parser.parse_args()
print ("options:", str(options))
print ("arguments:", args)
print options.input
main()
Note that options are stored in options and each option can be accessed by dest as string.
No comments:
Post a Comment