这是我的代码,我试图递归地调用单独的方法,但是在运行时,当我尝试从自身内部调用单独的方法时,总是收到错误消息。我对Python还是很陌生,我不确定是什么原因导致了此错误。
class operations():
def separate(string):
num1 = ""
num2 = ""
symbol = ""
def hasSymbol(string):
x=0
for x in string:
if(x == '&' or x == '^' or x == '|' or x == '<' or x == '>'):
return True
return False
if(hasSymbol(num1) == True):
separate(num1)
if(hasSymbol(num2) == True):
separate(num2) //this is the line thats throwing the error
return work(num1,symbol,num2)