如何计算后固定符号的值:我尝试过:
import operator
operator = {
'+': operator.add, '-': operator.sub,
'*': operator.mul, '/': operator.div, '%': operator.mod,
'**': operator.pow, '//': operator.floordiv,
}
l = []
exp = "11+2*"
for i in exp:
if i in operator:
a = operator[i]
x = l[0]
y = l[1]
l[-2:] = [a(*l[-2:])]
print l
else:
l.append(i)
print l
这个怎么做?