python fancy way to get arguments from the command line

Solutions on MaxInterview for python fancy way to get arguments from the command line by the best coders in the world

showing results for - "python fancy way to get arguments from the command line"
Grégoire
28 Jan 2019
1import optparse
2
3parser = optparse.OptionParser()
4
5parser.add_option('-q', '--query',
6    action="store", dest="query",
7    help="query string", default="spam")
8
9options, args = parser.parse_args()
10
11print 'Query string:', options.query
12