Arcpy remove invalid character
I've created a model that iterates through a shape file and pulls out unique values in a field. These unique values are then used to create new shapefiles with the name of the shapefile being the unique value. The problem is I have illegal characters (such as "-") in the unique values. How can I strip these out before the shapefile is made?
Here's the python:
# Import arcpy module import arcpy # Load required toolboxes arcpy.ImportToolbox("Model Functions") # Script arguments Inc_Birds2_shp = arcpy.GetParameterAsText(0) if Inc_Birds2_shp == '#' or not Inc_Birds2_shp: Inc_Birds2_shp = "C:\\Users\\OJB\\Desktop\\BurdsGIS\\Peru\\GIS\\Created\\Inc_Birds2.shp" # provide a default value if unspecified # Local variables: v_Output_Values_ = Inc_Birds2_shp v_Val__shp = v_Output_Values_ Val = Inc_Birds2_shp Testing = "C:\\Users\\OJB\\Desktop\\BurdsGIS\\Peru\\GIS\\Created\\Testing" # Process: Iterate Feature Selection arcpy.IterateFeatureSelection_mb(Inc_Birds2_shp, "Com_Name #", "false") # Process: Feature Class to Feature Class arcpy.FeatureClassToFeatureClass_conversion(v_Output_Values_, Testing,
I'm new to python and prefer working in Model Builder, but I think there is a strip function somewhere. I'm guessing I need to strip the illegal characters out of v_Output_Values_
Any help appreciated