Sherry Sherry - 1 year ago 129
Python Question

taking default value in argparse

I am using argparser module and when using the below two commands.
The first works fine, but the second one fails.

SyntaxError: invalid syntax

I want if no value is specified it should take today as the value.

I am fetching the result using

parser.add_argument('-sub4' , action='store' , dest='subject4' , help='Fourth subject' , type=str , default="")

parser.add_argument('-day' , action='store' , dest='day' , help="yesterday/week default-today , type=str , default="today")


wim wim
Answer Source

Missing closing quote here:

p="yesterday/week default-today
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download