Sherry Sherry - 2 months ago 19
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 results.day

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")


Thanks

wim wim
Answer

Missing closing quote here:

p="yesterday/week default-today