Greg Ewing 在 2023年1月24日 星期二清晨7:33:43 [UTC+8] 的信中寫道: > >> On 2023-01-22 at 18:19:13 -0800, > >> Jach Feng <jf...@ms4.hinet.net> wrote: > >>> 1) Modify the sys.argv by inserting an item '--' before parsing it, ie. > >>> sys.argv.insert(1, '--') > >>> args = parser.parse_args() > If you do that, you'll never be able to have any actual options, so > using argparse seems like overkill. Just pull the argument out of > argv directly. > > -- > Greg Any easy way to "pull the argument out of argv directly" before parse_args()?:-) -- https://mail.python.org/mailman/listinfo/python-list
- Re: How to make argparse accept "... Weatherby,Gerard
- Re: How to make argparse accept &... Grant Edwards
- Re: How to make argparse accept "-4^2+5.3... Mark Bourne
- Re: How to make argparse accept "-4^2+5.3... Cameron Simpson
- Re: How to make argparse accept "-4^2+5.3... Michael Torrie
- Re: How to make argparse accept "-4^2+5.3... Jach Feng
- Re: How to make argparse accept "-4^... 2QdxY4RzWzUUiLuE
- Re: How to make argparse accept "... Cameron Simpson
- Re: How to make argparse accept &... Chris Angelico
- Re: How to make argparse accept &... Greg Ewing
- Re: How to make argparse acce... Jach Feng
- Re: How to make argparse accept &... Jach Feng
- Re: How to make argparse acce... Chris Angelico
- Re: How to make argparse... 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 "-4^... Jach Feng
- Re: How to make argparse accept "... Cameron Simpson
- Re: How to make argparse accept &... Mike Baskin via Python-list