Merge items in list if criteria met

Discussion created by zackb11 on Apr 30, 2013
Latest reply on Apr 30, 2013 by jskinner-esristaff
I'm trying to create a python script that takes the features in my map and exports them to a geodatabase. The features are all Canvec 1:50k mapsheets. Sometimes my map contains multiple mapsheets, for example, my TOC could looks like this:


(where 031gXX is the mapsheet identifier)

Due to the restrictions in other parts of this script, I need to merge feature classes of the same type into one file. For example, all roads must be merged such that there is one file named "Roads", all waterbodies must be merged to one file named "Waterbodies", and so on.

I am having a little trouble getting my head around how I can search through my list of Feature Classes in my TOC, and only merge matching files.

I've been thinking that a while loop may work, but that's just a guess, as I've worked with them minimally.

Does anyone have any ideas of how I could do this?