using argparse
:
parser.add_argument("-o", "--output", help="Log to file")
I want to achieve the following behavior:
- The user doesn't specify the
-o
flag - no logging should be done. - User specifies the
-o
with nothing - I should log to a default location, defined within my program. - User specifies
-o
and a string(path) - I should log there.
Does anyone know the best way to use add_argument
to achieve that? I saw a similar example with int values, but in my case, it doesn't get my default value.