cameron...@gmail.com 在 2023年1月24日 星期二下午2:05:33 [UTC+8] 的信中寫道: > On 23Jan2023 17:58, Jach Feng <jf...@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 <c...@cskk.id.au> Hmm, good to you. During experiments in these days, I had found argparse shows some strange/unstable behaviors in dealing with the leading '-' situation. -- https://mail.python.org/mailman/listinfo/python-list
- Re: How to make argparse... Chris Angelico
- Re: How to make argp... Thomas Passin
- Re: How to make argp... Mike Baskin via Python-list
- Re: How to make argp... Thomas Passin
- Re: How to make argp... Weatherby,Gerard
- Re: How to make argp... Dennis Lee Bieber
- Re: How to make argparse accept "... Jach Feng
- Re: How to make argparse accept &... Cameron Simpson
- Re: How to make argparse acce... Mike Baskin via Python-list
- Re: How to make argparse accept &... Michael Torrie
- Re: How to make argparse accept &... Jach Feng
- RE: How to make argparse acce... avi.e.gross
- Re: How to make argparse acce... Jach Feng
- Re: How to make argparse accept &... Jach Feng
- Re: How to make argparse accept "-4^2+5.3... Jach Feng
- Re: How to make argparse accept "-4^... Chris Angelico
- Re: How to make argparse accept "... Cameron Simpson
- Re: How to make argparse accept "-4^... Jach Feng
- Re: How to make argparse accept "... Chris Angelico
- Re: How to make argparse accept "... Weatherby,Gerard
- Re: How to make argparse accept "... David