human
Solve in Python:
Construct a function that, when given a string containing an expression in infix notation, will return an identical expression in postfix notation.

The operators used will be `+`, `-`, `*`, `/`, and `^` with standard precedence rules and left-associativity of all operators but `^`.

The operands will be single-digit integers between 0 and 9, inclusive.

Parentheses may be included in the input, and are guaranteed to be in correct pairs.

```javascript 
toPostfix("2+7*5").
// Should return "275*+"
toPostfix("3*3/(7+1)").
// Should return "33*71+/"
toPostfix("5+(6-2)*9+3^(7-1)").
// Should return "562-9*+371-^+"
```
```python
to_postfix("2+7*5") # Should return "275*+"
to_postfix("3*3/(7+1)") # Should return "33*71+/"
to_postfix("5+(6-2)*9+3^(7-1)") # Should return "562-9*+371-^+"
```

You may read more about postfix notation, also called Reverse Polish notation, here:
http://en.wikipedia.org/wiki/Reverse_Polish_notation
 ... What is a Python code to fix notation, will return an identical expression in postfix notation?
assistant
#Here is Python code to fix notation, will return an identical expression in postfix notation.

#Infix to Postfix Converter: Implements Dijkstra's Shunting-yard algorithm

#simple stack class to be used by the conversion from infix to postfix
class Stack(object):
    def __init__(self):
        self.stack = []

    def getStack(self):
        return ''.join(self.stack)

    def peek(self):
        try:
            return self.stack[0]
        except IndexError as e:
            raise ValueError(e)
        
    def isEmpty(self):
        return len(self.stack)==0
    
    def pop(self):
        try:
            return self.stack.pop(0)
        except IndexError as e:
            raise ValueError(e)

    def push(self, v):
        self.stack.insert(0, v)
#end stack class


#Implements the Shunting-yard algorithm
class Ifix2PfixConverter():
    __EXP_OP = '^'
    __MUL_OP = '*'
    __DIV_OP = '/'
    __ADD_OP = '+'
    __SUB_OP = '-'
    __L_PAREN = '('
    __R_PAREN = ')'

    __precidenceTable = { __EXP_OP : 4,
                          __MUL_OP : 3, __DIV_OP : 3,
                          __ADD_OP : 2, __SUB_OP : 2 }

    __associativityTable  = { __EXP_OP : 'right',
                              __MUL_OP : 'left', __DIV_OP : 'left',
                              __ADD_OP : 'left', __SUB_OP : 'left' }

    def __init__(self, eqn):
        self.infixEqn = eqn
        self.postfixEqn = []
        self.stack = Stack()
        self.convertToPostfix()

    def isLeftAssociative(self, k):
        return 'left' == self.__associativityTable[k]

    def getPostfixEquation(self):
        return ''.join(self.postfixEqn)

    def isOperator(self, k):
        return  (k in self.__precidenceTable)

    def precidence(self,k):
        return self.__precidenceTable[k]

    def isOperand(self, k):
        return k.isalnum()

    def isLeftParen(self,k):
        return k==self.__L_PAREN

    def isRightParen(self,k):
        return k==self.__R_PAREN

    #Implementation of Dijkstra's Shunting-yard algorithm
    def convertToPostfix(self):

        for c in self.infixEqn:
            if self.isOperand(c):
              ...