I have a set of shapefiles that need a new field adding to them called "Policy_Ref". I then need to update this field with the shapefile name. However when I do, it uses the full title, including the .shp. However I do not want the .shp in the fields. This is my code so far:
import arcpy arcpy.workspace.env = r"teamGIS/shp" fcs = arcpy.ListFeatureClasses() for fc in fcs: arcpy.AddField_management(fc, "Policy_Ref", "TEXT") arcpy.CalculateField_management(fc, "Policy_Ref", "'" + fc + "'") arcpy.Merge_management(fcs, "new_shp")
How do I remove the .shp either before or after the code is executed?