i am looking for a method by which i can export fc list and fc count into xls or csv. for example i have 3 featureclass in Scratch.gdb.
1.PaLakh
2.PATest1
3.Point
i want all 3 of these featureclass name to be exported into a csv or xls. also the feature count of every featureclass against featureclass name.
i tried the below mentioned code, but instead of exporting fclist it exports every character of fc into a new row like.
p
o
i
n
t
import csv, arcpy, os
from arcpy import env
env.workspace = r"C:\Akhil_Office_1\Python\ToolBox\Scratch\Scratch.gdb"
fclist = arcpy.ListFeatureClasses()
for fc in fclist:
csv_out = open(r'C:\Akhil_Office_1\Python\ToolBox\Scratch\test.csv', 'wb')
mywriter = csv.writer(csv_out)
rows = zip(arcpy.env.workspace, fc)
mywriter.writerows(rows)
csv_out.close()
or is there any other way in arcpy to export feature class name list into xls ?
fclist
which should contain a list of feature classes. However, it does not use that variable anywhere. The output you provided does not appear to match your code snippet. For us to help we need to see exactly the code snippet that you are running to produce the symptoms you observe. My strong suspicion is that the cause of your observations stems from how you are iterating your list which is pure Python rather than ArcPy and may be better researched at Stack Overflow.