I want to tokenize a given mathematical expression into a parse tree like this:
((3 + 4 - 1) * 5 + 6 * -7) / 2 \'/\'
Several parser frameworks exist for Python; some common ones are PLY and pyparsing. Ned Batchelder has a pretty complete list.