Select to view content in your preferred language

arcpy.ListTables

442
2
Jump to solution
09-26-2023 01:00 PM
kapalczynski
Occasional Contributor III

I am looking for three table names in my GDB.  Is there a way to put this into one statement

Im trying to use wildcard with * to grab all instances of that name

ListTables ({wild_card}, {table_type})

 

tablesList1 = arcpy.ListTables("*TBL_BMP_*")
tablesList2 = arcpy.ListTables("*SDE_BMP_Component*")
tablesList3 = arcpy.ListTables("*SDE_BMP_Inventory*")

 

 

tablesList1 = arcpy.ListTables("[*TBL_BMP_*,*SDE_BMP_Component*,*SDE_BMP_Inventory*]")

 

 

 

 

0 Kudos
1 Solution

Accepted Solutions
kapalczynski
Occasional Contributor III

I think I can get it with this?  Testing now..

FCS = set(arcpy.ListTables("X_*") + arcpy.ListTables("*_Y"))

View solution in original post

2 Replies
kapalczynski
Occasional Contributor III

I think I can get it with this?  Testing now..

FCS = set(arcpy.ListTables("X_*") + arcpy.ListTables("*_Y"))
BlakeTerhune
MVP Regular Contributor

This is untested, but you get the idea.

tables_found = []

for wildcard_name in ["*TBL_BMP_*", "*SDE_BMP_Component*", "*SDE_BMP_Inventory*"]:
    tables_found += arcpy.ListTables(wildcard_name)