Thanks for previous help. This question follows on an earlier one that was so helpfully answered.
I've generated a 'ctylist' variable with ListFeatureClasses
I now want to iterate through that list (of counties), and use each county boundary in a sequence of spatial queries and geoprocessing tasks.
I think the final results would be best if they were within a unique feature dataset (one for each county).
I've set up the code snippet below)to create those feature datasets (a set of county feature classes in a gdb created earlier in the script by StripByAttribute) within the for: loop, but can't figure out how to assign the county name to the new feature dataset (the Pro help examples show how to provide a specific name.
I think It would help to create a 'name' variable..and I've seen others suggesting use of a .format. command, but I'm stuck ..
ctylist = arcpy.ListFeatureClasses(r"E:\advAppScripting\testing\tornhazard\Indiana\Indiana.gdb")
for cty in ctylist:
arcpy.CreateFeatureDataset_management(r"E:\advAppScripting\testing\tornhazard\Indiana\Indiana.gdb", cty)
arcpy.CopyFeatures_management(cty, r"E:\advAppScripting\testing\tornhazard\Indiana\Indiana.gdb" + cty)
WIll appreciate any suggestions.
Solved! Go to Solution.
normally, that's my principle also, but in this case I created the feature datasets from the ListFeatureClass() list, and when I tried to change the name of the output so it wouldn't be the same as the input fc, it failed. I'll look again at the os.path.join step and see if i can name the feature datasets differently to start with...