I have a simple line of code that requires the following inputs - an input file, output file and a SQL expression. the code needs to be run with several different SQL expressions to produce multiple output files. To do this I first created a list of a portion of the output filename: mylist = ('name1', 'name2', 'name3')
I also assigned variables for each SQL expression: name1 = "\"field_a\" LIKE '021'" name2 = "\"field_a\" LIKE '031'" name3 = "\"field_a\" LIKE '041'" Notice the variable names are the same as the listmember strings, that is intentional, but obviously doesn't work. the loop: for listmember in mylist: print listmember + ".shp", listmember my intended output is: name1.shp "field_a LIKE '021' name2.shp "field_a LIKE '031' name3.shp "field_a LIKE '041' but, of course, the variable listmember returns the name of the listmember which makes perfect sense to me: name1.shp name1 So how can I iterate not only the filenames but the SQL expressions as well? -- http://mail.python.org/mailman/listinfo/python-list