I have path to layer or feature
C:\base.gdb\test
How to check is table or feature class by arcpy?
I have path to layer or feature
C:\base.gdb\test
How to check is table or feature class by arcpy?
You may use Describe Object property dataType:
desc = arcpy.Describe("C:/base.gdb/test")
if desc.dataType == 'FeatureClass':
print 'fc'
elif desc.dataType == 'Table':
print 'table'
else: print desc.dataType
Use the arcpy.List... functions. First have to set the env.workspace to the fgdb. Then use arcpy.ListTables() or arcpy.ListFeatureclasses(). Each of these returns a python list of the requested type. If the list is empty (len(list) == 0), then there is no thing of that type. Unfortunately there does not seem to be a higher level function like arcpy.ListContents() or something.