The following code will work for sympify boolean expressions:
sympify('a&b') # And(a, b) sympify('a|b') # Or(a, b)
But how do I get the result Not(a)?
Not(a)
It turns out that the character you are looking for is ~. See the following:
~
>>> from sympy import sympify >>> sympify('a&b') And(a, b) >>> sympify('a|b') Or(a, b) >>> sympify('~a') Not(a)
Source: https://habr.com/ru/post/1599388/More articles:Are there any bold specific areas of imagesc in MATLAB? - matlabjava.lang.NullPointerException при попытке создания отчета Allure - javasave file dataframe.hist () to file - python-2.7Convert Pascal 'type to C # - c #in python pandas how to save the "grid"? - pythonКак проверить тип структуры в C - cDjango assertTemplateUsed () throws an exception with Jinja patterns - pythonReplacing some characters in a string with characters stored in an array inserts garbage - cHow to get Google to automatically register a user in PassportJS? - javascriptThe density of the plot with ggplot2 without a line along the x - r axisAll Articles