How to calculate value for a expression in a string, then return a new string?
<p>i read data from my config file like this:</p>

<pre><code>ip_vlan1 = "10.10.($id+100).5"
ip_vlan2 = "10.11.($id*2+1).6"
v.v...
</code></pre>

<p>And for each vlan, I want calculate vlan address for it, based on ID and vlan-expression:</p>

<pre><code>def calculate_vlan_id(id, vlan_exp):
    ...
    return ip_addr   # string
</code></pre>

<p><strong>Example:</strong></p>

<pre><code>def(3, ip_vlan1) --&gt; result: "10.10.103.5"
def(5, ip_vlan2) --&gt; result: "10.11.11.6"
</code></pre>

<p>Do you have a solution for this?</p>

<p>Thanks in advance, folks!</p>
