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

Grant Edwards grant.b.edwards at gmail.com
Mon Jan 23 10:34:33 EST 2023


On 2023-01-22, Weatherby,Gerard <gweatherby at uchc.edu> wrote:
> Argparse is for parsing command line arguments and options.
>
> If you just want to evaluate an Python expression, use eval( )

Only use eval() if the expression is always under your control (and
you don't make mistakes when typing).

Don't use eval() on strings that come from the outside world.



More information about the Python-list mailing list