Because in this case serialc is an numpy array. Since loadtxt returns a numpy-array. Furthermore <br><br>locals()['serialc_bin' + str(i+1)]  creates a dictionary key (that's what I use the term "variable-like") serialc_bin1, serialc_bin2, ... not serialc_bin[0] with indexes. <br>
<br><br clear="all">Gökhan<br>
<br><br><div class="gmail_quote">On Fri, May 22, 2009 at 9:43 AM, David Robinow <span dir="ltr"><<a href="mailto:drobinow@gmail.com">drobinow@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Fri, May 22, 2009 at 10:27 AM, Gökhan SEVER <<a href="mailto:gokhansever@gmail.com">gokhansever@gmail.com</a>> wrote:<br>
...<br>
<div class="im">> serialc = np.loadtxt(sys.argv[1], skiprows=skiprows).T<br>
> for i in range(20):<br>
>     locals()['serialc_bin' + str(i+1)] = serialc[i+4]<br>
><br>
> I don't know easier way than using locals() to construct variable-like<br>
> identities in my program.<br>
<br>
</div>I don't either.  I also don't know why you feel you need to construct<br>
variable-like identities.<br>
Why is:<br>
  serialc_bin1<br>
better than<br>
  serialc_bin[0]<br>
or, for that matter,<br>
 serialc[4]<br>
<br>
???<br>
<div><div></div><div class="h5">--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</div></div></blockquote></div><br>