On 10/21/07, <b class="gmail_sendername">Bryan Fodness</b> &lt;<a href="mailto:bryan.fodness@gmail.com">bryan.fodness@gmail.com</a>&gt; wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>&nbsp;</div>
<div>I&nbsp;want to get a variable name dependent on another variable.&nbsp;&nbsp;I have tried,</div>
<div>&nbsp;</div>
<div>&#39;fs&#39; + str(int(round(unblockedFS))) for fs13</div>
<div>&nbsp;</div>
<div>and I get an invalid literal.&nbsp; If I code in the fs13, everything works. Is it possible to do this?</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>unblockedFS=13.4</div>
<div>&nbsp;</div>
<div>for line in file(&#39;21Ex6MV_tmr.dat&#39;):<br>&nbsp;&nbsp;&nbsp; d, fs1, fs2, fs3, fs4, fs5, fs6, fs7, fs8, fs9, fs10, fs11, fs12, fs13, fs14, fs15, fs16, fs17, fs18 = line.split()<br>&nbsp;&nbsp;&nbsp; if float(d) == round(calc_depth):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b = float(
<font color="#cc9933">fs13</font>)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print float(<font color="#cc9933">fs13</font>)<br>&nbsp;</div>
<div>Thanks,</div><span class="sg">
<div>Bryan</div></span></blockquote><div><br>Hi Bryan,<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Have you thought about using a dictionary instead of slew of variables? IHMO, that will cut down on the number of variables that you have to juggle. So instead of 
<br>fs1,fs2,fs3.......<br>you would have <br>fs={}<br>fs[1]=........<br>...<br>fs[18=......<br><br><br>-HTH,<br>Tino<br><br></div></div>