功能好像是实现了,但是实在写的太烂了,写的很懵,学习中。。。。
s = '9-(1+2)'#(1+2)*3
stack_op = []
stack_num = []
# + - * ( )
# op_order = ['#','+','-','*','('] 1代表进栈
level = [[0,1,1,1,1,0],[0,0,0,1,1,0],[0,0,0,1,1,0],[0,0,0,0,1,0],[0,1,1,1,1,0]]
stack_op.append('#') #*
def get_op_order(top):
if top == '#':
op_order = 0
elif top == '+':
op_order = 1
elif top == '-':
op_order = 2
elif top == '*':
op_order = 3
elif top == '(':
op_order = 4
elif top == ')':
op_order = 5
return op_order
for i in range(len(s)):
if s[i] >=