[GRASS-dev] python question

Anna Kratochvílová kratochanna at gmail.com
Sun Jun 24 00:56:22 PDT 2012


Hi,

On Sat, Jun 23, 2012 at 9:48 PM, Michael Barton <michael.barton at 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 at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-dev


More information about the grass-dev mailing list