(cls, expr)
return vals, ops
Get the operands and operators into lists from a string expression
Get the operands and operators into lists from a string expression
Get the operands and operators into lists from a string expression
def readExpression(cls, expr):
        """Get the operands and operators into lists from a string expression"""
        ops = []
        vals = []
        p = re.compile('[()*/+-]')
        x = p.split(expr)
        ops = p.findall(expr)
        #print expr, ops
        for i in x:
            if i == '':
                vals.append(i)
            else:
                vals.append(eval(i))

        #print ops, vals
        return vals, ops
def readExpression ( cls , expr ) : ops = [ ] vals = [ ] p = re . compile ( '[()*/+-]' ) x = p . split ( expr ) ops = p . findall ( expr ) #print expr, ops for i in x : if i == '' : vals . append ( i ) else : vals . append ( eval ( i ) ) #print ops, vals return vals , ops