duration = inputScriptLine.split(' ', 1)[1]
if type(duration) == str:
print ' Error: Sleep duration "' + duration + '" is not numeric'
given SLEEP 50
, I get Error: Sleep duration "50" is not numeric
I am not too concerned as to why, I just want to know how I can code so that SLEEP 50
is valid and SLEEP APNOEA
is not.
Use isdigit():
if not duration.isdigit():
print 'Error: Sleep duration "' + duration + '" is not numeric'
It would check whether all characters in duration
are digits or not.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With