Best way to make argument parser accept absolute number and percentage?
问题 I am trying to write a Nagios style check to use with Nagios. I have working script that takes in something like -w 15 -c 10 and interprets that as "Warning at 15%, Critical at 10%". But I just realized that in the built-in Nagios plugins, the same arguments would mean "Warning at 15MB, Critical at 10MB"; I would instead need to enter -w 15% -c 10% to get the above behavior. So my question is, what is the best way to make my script behave like the built-in Nagios scripts? The only way I can