arcpy write a list of feature datasets from a geodatabase to a csv file

Lets be a little more specific as to what we want to do so I will reformulate the title now:

How to write to a CSV file a list of ESRI ArcGIS personal geodatabase feature classes and feature sets using arcpy?

As usual here is the code first since we are all impatient :)

code is on Github
most of it is self explanatory but who knows.  We assume you have a running copy of ArcGIS 10.2 in this case with on my machine I have ArcGIS10.2 installed and the python interpreter is located here c:\arcgis\Python27\ArcGIS10.2\python.exe

I think only a few lines might need explaining

line 27  wr.writerow(each_fs.split(","))

The .split(",") prevents our CSV from spitting out "f", "c", "_","n","a","m","e", "F","o","o.......
  where our list is  fcList= ["fc_nameFoo","fc_nameFee"]

If you want to write this all to one single line in the csv you can uncomment the section in the first for loop located at line25

Other wise the script will output every feature class name to one line in the new CSV file.

Hope that helps.

cheers
Michael

Comments

Popular Posts