Skip to main content

ListTables

汇总

返回当前工作空间中的表格列表。

讨论

如果工作空间中存在数据库视图,它们将在表列表中返回。

必须先设置工作空间环境,然后才能使用多个列表函数,包括 ListDatasetsListFeatureClassesListFilesListRastersListTablesListWorkspaces

语法

ListTables({wild_card}, {table_type})

参数 说明 数据类型

wild_card

限制返回的结果。如果未指定某一值,则返回所有值。通配符不区分大小写。

符号

说明

示例

*

表示零个或多个字符。

Te* 可找到田纳西州和德克萨斯州。

*

table_type

The table type to limit the results.

  • dBASE—Only tables of type dBASE are returned.

  • INFO—Only stand-alone INFO tables are returned.

  • ALL—All stand-alone tables, including geodatabase tables, are returned. This is the default.

(默认值为 All)

String

返回值

数据类型 说明

String

该函数返回的列表包含受可选 wild_cardtable_type 参数限制的工作空间中的表名称。

代码示例

ListTables 示例

列出工作空间中的所有表名称。

import arcpy

# Set the current workspace
arcpy.env.workspace = "c:/data/mydata.gdb"

# Get and print a list of tables
tables = arcpy.ListTables()
for table in tables:
    print(table)