How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?

Michael Torrie torriem at gmail.com
Fri Jan 27 19:34:53 EST 2023


On 1/25/23 19:50, Jach Feng wrote:
> To me, argparse has been just a tool which I can use in a CLI app. 

argparse is just a tool for dealing with command-line *flags*, which are
common in command-line tools.  argparse interprets the command line as a
bunch of flags because that's what it's designed to do.  I find it
baffling that you expect some other behavior from argparse.

You don't need or want argparse in this situation. sys.argv has
everything you need in it. Use it directly!



More information about the Python-list mailing list