I am having trouble getting the List Fields function to work. I need to search through a number of shapefiles located in different folders to list the fieldnames so I can see what are common naming conventions. I thought the easiest way for me to replicate this is by creating a new tool so I could use the batch command to go through each selected shapefiles
fc = arcpy.GetParameterAsText(0)
fieldList = arcpy.ListFields(fc)
for field in fieldList:
fname = field.name
falias = field.aliasName
ftype = field.type
flength = field.length
print "%s \t %s \t %s \t %i" % (field.name, field.aliasName, field.type, field.length)
How would I then go from here to have that list visible?
When i run this through the tool it says it succeeded but there is no way to view the printed names.
list
ofdictionary
objects would suffice, or your ownclass
, but these are Python fundamentals and probably off-topic for a GIS-focused question. If you're just concerned with output, the you need to leverage the Messages environment of ArcPy.