我试图学习SymPy。我写了以下内容并且发出错误。我甚至没有做任何复杂的事情......
from sympy.solvers import solve
from sympy import Symbol
string = "10x+4=7"
#equation = raw_input("Enter an equation")
left, right = string.split('=')
string = left + "-(" + right + ")";
print string
x = Symbol('x')
print solve(string, x)
此代码抛出错误:
raise SympifyError('could not parse %r' % a, exc)
sympy.core.sympify.SympifyError: Sympify of expression 'could not parse u'10x+4-(7)'' failed, because of exception being raised:
SyntaxError: invalid syntax (<string>, line 1)
为什么会这样?