variable hell

Nx nomail at nomail.com
Thu Aug 25 09:19:10 EDT 2005


Hi

 I am unpacking a list into variables, for some reason they need to be
 unpacked into variable names like a0,a1,a2....upto aN whatever is 
 in the list.

 How to create the variables dynamically ?

 I am looking for something like 
 pseudo code line follows :

 a%s = str(value)


 here below is a snippet from the mylist unpack code

 #next lines cut the end of line character from each line in the list
   mylist = [line[:-1] for line in mylist]
  
   for index,value in enumerate(mylist):
      if index == 0 :
        a0 = str(value)
        print "a0 : ",a0
      elif index == 1 :
        a1 = str(value)
        print "a1 : ",a1

       

Thanks
Nx




More information about the Python-list mailing list