Hi Jenny Long story short: use your command like this (note the asterisk on the 'pattern' variable):
# python code p=grass.mlist_grouped ('rast', pattern='output*', mapset='Mapping') I am using the Ipython shell to script grass. It has a cool feature, that if you type the name of a function followed by two question marks, you can see the source code of the function (as long as it is coded in python itself). So, in doing: grass.mlist_grouped?? It is possible to see that the mlist_grouped function is internally calling the 'g.mlist' command with only the 'm' flag. Reading the documentation for the g.mlist command [1], I realize that, without using the -r or -e flags, this command accepts wildcards[2] as the 'pattern' string. The asterisk (*) is the wildcard character for substituting for any zero or more characters. So, in order to get a string that starts with 'output' and after that can have anything, you just type 'output*' [1] - http://grass.fbk.eu/grass64/manuals/html64_user/g.mlist.html [2] - http://en.wikipedia.org/wiki/Wildcard_character#Computing On Fri, Mar 11, 2011 at 12:10 PM, Jenny Turner <jennyturner1...@gmail.com> wrote: > Greetings > I'm doing a GRASS Python Script where I need to list a set of raster maps > but I'm not using its exact name but a basic regular expression (r flag in > g.mlist function). > So I want to find a list of rasters with output on its name: > p=grass.mlist_grouped ('rast', pattern='output', mapset='Mapping') > But I get null entries because no raster map is named output only output01 > output02 output03 ... > I want to list all raster maps with output on itsd name. How can I do this > using grass.mlist_grouped? > Thanks > Jenny > _______________________________________________ > grass-user mailing list > grass-user@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/grass-user > > -- ___________________________ ___ __ Ricardo Garcia Silva _______________________________________________ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user