How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?
Mike Baskin
mikebaskin6538 at yahoo.com
Tue Jan 24 09:03:58 EST 2023
Stop please
Sent from Yahoo Mail for iPhone
On Tuesday, January 24, 2023, 1:05 AM, Cameron Simpson <cs at cskk.id.au> wrote:
On 23Jan2023 17:58, Jach Feng <jfong at ms4.hinet.net> wrote:
>>>> parser.parse_args(['--', 'infix2postfix.py', '-4.3+5'])
>usage: [-h] infix
>: error: unrecognized arguments: -4.3+5
This error doesn't look like "-4.3+5 looks like an option" but instead
"we don't expect any arguments after "infix".
Not personally a fan of argparse myself, but then I have my own
elaborate command line framework which generally uses getopt for the
option stuff.
Cheers,
Cameron Simpson <cs at cskk.id.au>
--
https://mail.python.org/mailman/listinfo/python-list
More information about the Python-list
mailing list