Question about locals()

David Robinow drobinow at
Fri May 22 16:43:01 CEST 2009

On Fri, May 22, 2009 at 10:27 AM, Gökhan SEVER <gokhansever at> wrote:
> serialc = np.loadtxt(sys.argv[1], skiprows=skiprows).T
> for i in range(20):
>     locals()['serialc_bin' + str(i+1)] = serialc[i+4]
> I don't know easier way than using locals() to construct variable-like
> identities in my program.

I don't either.  I also don't know why you feel you need to construct
variable-like identities.
Why is:
better than
or, for that matter,


More information about the Python-list mailing list