ValidateTableName

サマリー

Returns a valid table name for a workspace based on a table name and a workspace path. All invalid characters in the input table name are replaced with an underscore. The table name restrictions depend on the type of database.

構文

ValidateTableName (name, {workspace})
パラメーター説明データ タイプ
name

The table name that will be validated.

String
workspace

The workspace that will be used to validate the table name.

If the workspace is not specified, the Current Workspace environment will be used. If the Current Workspace environment is not set, a folder workspace will be used.

String
戻り値
データ タイプ説明
String

A valid table name for the workspace.

コードのサンプル

ValidateTableName example

Valid table names for the workspace are returned before copying.

import os
import arcpy

# Get the input and output workspaces.
arcpy.env.workspace = arcpy.GetParameterAsText(0)
out_workspace = arcpy.GetParameterAsText(1)

# Get a list of input feature classes to be copied and copy to new output 
# location.
for fc in arcpy.ListFeatureClasses():
    out_fc = arcpy.ValidateTableName(fc, out_workspace)
    arcpy.management.CopyFeatures(fc, os.path.join(out_workspace, out_fc))

関連トピック