I have a folder with hundreds of shapefiles each representing a diff. state, each file starts with the prefix for that specific state e.g., al001r.shp, al003r.shp, fl001.shp, fl003.shp...etc. What I'm trying to do is Append the shapefiles for each state into one shapefile via python, in the end having a single shapefile for each state. I'm thinking I need to create a list of each of the prefixes and enumerate through the list thus creating a list of inputs for a multivalue input for the append? This is about as far as I've gotten, can't figure out how to select just the first iteration and push to a list for multi-input? dir = r"C:\temp"
gp.workspace = dir
print(dir)
files = os.listdir(dir)
alist = ['al', 'ct', 'dc', 'de', 'fl']
for file in files:
sfile = file[0:2]
if sfile in alist:
alist[alist.index(sfile)]
print(sfile)