Thanks Anna and Glynn, I got the same advice from a colleague here: use a dictionary. Works perfectly to resolve the problem.
Michael Barton School of Human Evolution &Social Change Center for Social Dynamics & Complexity Arizona State University ...Sent from my iPad On Jun 24, 2012, at 1:56 AM, "Anna Kratochvílová" <kratocha...@gmail.com> wrote: > Hi, > > On Sat, Jun 23, 2012 at 9:48 PM, Michael Barton <michael.bar...@asu.edu> > wrote: >> This is probably simple but I'm missing something somewhere. How can I >> dynamically create variable names and then assign values to the variables? I >> need to do something along the lines of: >> >> for i in flist: >> 's%_new' % i = 10 >> >> where flist is a list of strings (e.g., file names) >> >> > > You can find answer here: > > http://stackoverflow.com/questions/2320945/python-using-vars-to-assign-a-string-to-a-variable > > example of using function vars is in wxpython/gui_core/toolbars.py, line 130 > > Anna > >> Thanks >> Michael >> >> _____________________ >> C. Michael Barton >> Visiting Scientist, Integrated Science Program >> National Center for Atmospheric Research & >> University Consortium for Atmospheric Research >> 303-497-2889 (voice) >> >> Director, Center for Social Dynamics & Complexity >> Professor of Anthropology, School of Human Evolution & Social Change >> Arizona State University >> www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu >> >> >> >> >> >> >> _______________________________________________ >> grass-dev mailing list >> grass-dev@lists.osgeo.org >> http://lists.osgeo.org/mailman/listinfo/grass-dev _______________________________________________ grass-dev mailing list grass-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-dev