[Tutor] corresponding command in Python to "eval" in Matlab

Happy Deer ihappydeer at gmail.com
Sun Oct 7 22:07:00 CEST 2007


Dear all-

I wonder whether there is a way in Python which can do what "eval" in
Matlab  does.
Say, varlist is a 1 by k tuple/list, which contains strings for variable
names.
For example, varlist=['var1','var2',...'vark']
data is a n by k matrix.
I want to assign each column in data to each variable in varlist and get
var1=data[:,1]... vark=data[:,k]

Anyone knows how to do this?

Fangwen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20071007/2b505d3d/attachment.htm 


More information about the Tutor mailing list