<div>Here&#39;s where I am:</div>
<div>&nbsp;</div>
<div>
<p><font face="courier new,monospace">def source(filename, vList):<br>&nbsp;&quot;&quot;&quot; takes a file object and a list of variables as input &quot;&quot;&quot;<br>&nbsp;import re<br>&nbsp;# Read the file<br>&nbsp;fid=open(filename,&#39;r&#39;)
<br>&nbsp;lines = fid.readlines()<br>&nbsp;fid.close()<br>&nbsp;#how many variables<br>&nbsp;ns=len(lines)/len(vList)<br>&nbsp;#predefine the varibles<br>&nbsp;for v in vList:<br>&nbsp;&nbsp;exec( &#39;global %s ; %s = [0]*(ns+1)&#39; % (v, v))<br>&nbsp;&nbsp;<br>&nbsp;# Make it python friendly: put all values in &#39;single quotes&#39;
<br>&nbsp;cmd = &#39;\n&#39;.join([re.sub( r&#39;^([^=]+)=(.*)$&#39;, r&quot;\1=&#39;\2&#39;&quot;, v) for v in lines])<br>&nbsp;exec(cmd)<br>&nbsp;for v in vList:<br>&nbsp;&nbsp;exec( &#39;%s=%s[1:]&#39; % (v,v))<br>&nbsp;<br>source(&#39;infile.py&#39;,[&#39;files&#39;,&#39;nfiles&#39;,&#39;nreleases&#39;])
</font></p>
<p><font face="courier new,monospace">print files<br>print nreleases<br>print nfiles</font></p>
<p><font face="Courier New"></font>&nbsp;</p>
<p><font face="Courier New">But oddly, my output is:</font></p>
<p>[0, &#39;ASP_200603&#39;, &#39;ASP_200604&#39;, &#39;ASP_200605&#39;]<br>[0, &#39;248&#39;, &#39;240&#39;, &#39;248&#39;]<br>[0, &#39;3&#39;, &#39;3&#39;, &#39;3&#39;]</p>
<p>&nbsp;</p>
<p>So, I am not properly getting rid of the list[0], is it something with the &#39;global&#39; nature of the vairables... it looks like it&#39;s only changing locallly in my source function.<br></p></div>