So I'm converting a set of polygons into rasters and need to remove a portion of their basenames while keeping them unique at the same time. The error code I am getting is "TypeError: unsupported operand type(s) for -: 'unicode' and 'str'" obviously it has something to do with the " - ". I have tried to designate "_buffer" as a string [str("_buffer")] and that didn't work either.
here is the code
import arcpy
from arcpy import env
env.workspace = r"N:\geog327\python15\Project"
env.overwriteOutput = True
DenMetHwyBuff = r"N:\geog327\python15\Project\DenMetHwys_buffer.shp"
DenMetIntBuff = r"N:\geog327\python15\Project\DenMetInts_buffer.shp"
DenMetRiverBuff = r"N:\geog327\python15\Project\DenMetRivers_buffer.shp"
DenMetLakeBuff = r"N:\geog327\python15\Project\DenMetLakes_buffer.shp"
vectorlist4 = [DenMetHwyBuff, DenMetIntBuff, DenMetRiverBuff,
DenMetLakeBuff]
outraster = desc.basename - "_buffer.shp" + ".tif"
for fc in vectorlist4:
desc = arcpy.Describe(fc)
outraster = desc.basename - "_buffer.shp" + ".tif"
arcpy.PolygonToRaster_conversion (fc, "Bad", outraster)