python - sympy: how to sympify logical "NOT" -
the following code work sympify logical expressions:
sympify('a&b') # and(a, b) sympify('a|b') # or(a, b)
but how result of not(a)
?
it turns out symbol looking ~
. see following:
>>> sympy import sympify >>> sympify('a&b') and(a, b) >>> sympify('a|b') or(a, b) >>> sympify('~a') not(a)
Comments
Post a Comment