[Tutor] a code question, but don't know question's name
Happy Deer
ihappydeer at gmail.com
Sun Oct 7 07:42:04 CEST 2007
Dear all-
I am writing a function as follows.
def getdata(varlist):
....
eventually I have a variable called "data", which have exactly the same
number of columns as the name of variables in varlist.
Say varlist=['var1','var2','var3']. I want to assign var1=data[:,0],
var2=data[:,1], var3=data[:2] and return var1, var2, var3.
But when I write the function, I only know I want to assign data[:,0] to a
variable which has a name as varlist[0]. How to write this?
Thank you!
Deer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20071006/059b4da2/attachment.htm
More information about the Tutor
mailing list