By using sympy.sympify(), I can parse user input math string input eg:(1+2.2)*3but it may return a result with 0s in the tail, eg:3.000000
to remove these .0 s
strVal = strVal if strVal.find('.') == -1 else strVal.strip('0')
沒有留言:
張貼留言