parsing to an expression tree in python
<p>I have a genetic program that prints the expression tree to a file (it can easily switch between pre/post/in-fix)</p>

<p>It seems like pre-fix would be the easiest to parse so I am currently using that.</p>

<p>How would I go about parsing this string using python 2.7? For example, how would I parse the string   +(*(2,1),*(4,3))      ~~~~ which is 2*1+4*3</p>

<pre><code>f = open('expression_tree.txt', 'r')
input = f.read()
root_node_operator = input[0]
</code></pre>

<p>That's about as far as I've gotten. I'm not that familiar with parsing. Thanks!</p>

<p>I have one python program that prints the expression tree data structure and I want to parse it and evaluate it in the next python program.</p>

<p>Or is there a way to pass the expression tree object to the next python program so no parsing is needed? like I have my tree called test_tree in GP.py. Can I somehow get at that from my other file MyBot.py?</p>
