ValidateTableName (arcpy)

サマリ

Takes a table name and a workspace path and returns a valid table name for the workspace. An underscore "_" will replace any invalid character found in the table name and will honor the name restrictions for the workspace. The table name restrictions depend on the specific RDBMS used.

構文

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

The table name to be validated.

String
workspace

The optional workspace against which to validate the table name.

If the workspace is not specified, the table name is validated using the current workspace environment. If the workspace environment has not been set, the table name is validated based on a folder workspace.

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

The valid table name for the workspace, based on name restrictions of the workspace.

コードのサンプル

ValidateTableName example

Returns a valid table name for the workspace.

import arcpy
from arcpy import env

# Get the input and output workspaces
#
inWksp = arcpy.GetParameterAsText(0)
outWksp = arcpy.GetParameterAsText(1)

# Get a list of input feature classes to be copied.
#
env.workspace = inWksp
fcList = arcpy.ListFeatureClasses()

# Copy input features classes to new output location.
#
arcpy.env.workspace = outWksp
for fc in fcList:
    outFC = arcpy.ValidateTableName(fc)
    arcpy.CopyFeatures_management(fc, outFC)

関連トピック

9/14/2013