-1

I have path to layer or feature

C:\base.gdb\test

How to check is table or feature class by arcpy?

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
user7172
  • 1,529
  • 2
  • 24
  • 45

2 Answers2

4

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
artwork21
  • 35,114
  • 8
  • 66
  • 134
-1

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.

Neil Ayres
  • 302
  • 1
  • 6