I have a multipolygon shapefile representing different cities. I am trying to loop the "v.extract" GRASS command through the different polygons via the Python interface. 
This is the code I am using: 
```
    for index, row in df.iterrows():
        city_code = (row['city_ID'])
        grass.run_command('v.extract', overwrite=True, input='six_cities', output= 'out' + city_code,
                      where= 'city_ID' + "=" + city_code)
```
Where **df** is the df version of the attribute table.
However, I always get the module error. I believe this is due to the "**where**" condition, as I tried to do it without the loop and it works (code below):

```
grass.run_command('v.extract', overwrite=True, input='six_cities', output= 'out' + city_code,
                      where= " 'city_ID' = 'CH_CH6421' ")
```
It seems that in order to run, the "where" condition needs to be within quotes. However, I cannot run the loop within quotes, because in this way python recognizes the city_code keyword needed for the loop as a string.