[GRASS-user] g.remove multiple files in python

Nikos Alexandris nik at nikosalexandris.net
Fri Jan 25 06:45:41 PST 2013


Margherita Di Leo wrote:

> how to convert something like:

> g.remove rast=`g.mlist pat=r_start* sep=,`
 
> in python?

MaDi,

wouldn't a simple 

# get list of r_start* raster maps -- split line-by-line
list_of_r_starts = grass.read_command('g.mlist', type= "rast" , pat = 
"r_start*")
r_starts = list_of_r_starts.splitlines()

and then feed "g.mrenove" work for you?

Best, N

ps- sorry, old py-grass read_command in my example.


More information about the grass-user mailing list