ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • ヘルプ
  • Sign Out
ArcGIS Desktop

ArcGIS Online

組織のマッピング プラットフォーム

ArcGIS Desktop

完全なプロ仕様の GIS

ArcGIS Enterprise

エンタープライズ GIS

ArcGIS Developers

位置情報利用アプリの開発ツール

ArcGIS Solutions

各種業界向けの無料のテンプレート マップおよびテンプレート アプリケーション

ArcGIS Marketplace

組織で使えるアプリとデータを取得

  • ドキュメント
  • サポート
Esri
  • サイン イン
user
  • マイ プロフィール
  • サイン アウト

ArcMap

  • ホーム
  • はじめに
  • マップ
  • 解析
  • データ管理
  • ツール
  • エクステンション

GetArgumentCount

  • 概要
  • 構文
  • コードのサンプル

概要

Returns the number of arguments passed to the script.

構文

GetArgumentCount ()

戻り値

データ タイプ説明
Integer

The number of arguments passed to the script.

コードのサンプル

GetArgumentCount example 1

Check for required number of arguments to run the Clip tool and handle optional argument.

import arcpy

# Set workspace
arcpy.env.workspace = "c:/data/airport.gdb"

# Set local variables
in_features = arcpy.GetParameterAsText(0)
clip_features = arcpy.GetParameterAsText(1)
out_feature_class = arcpy.GetParameterAsText(2)
xy_tolerance = arcpy.GetParameterAsText(3)

# Check for required number of arguments
if arcpy.GetArgumentCount() < 3:
    print("3 arguments required for Clip_analysis tool")

# Execute Clip tool
try:
    arcpy.Clip_analysis(in_features, clip_features,
                        out_feature_class, xy_tolerance)
except arcpy.ExecuteError:
    print(arcpy.GetMessages(2))
GetArgumentCode example 2

The following sample uses the GetArgumentCount and GetParameterAsText functions to assign all parameter values in a script tool to a single variable as a list of values.

import arcpy

args = [arcpy.GetParameterAsText(i) for i in range(arcpy.GetArgumentCount())]

関連トピック

  • CopyParameter
  • GetParameter
  • GetParameterAsText
  • GetParameterCount
  • GetParameterInfo
  • GetParameterValue
  • SetParameter
  • SetParameterAsText
  • スクリプト ツール パラメーターの設定

ArcGIS Desktop

  • ホーム
  • ドキュメント
  • サポート

ArcGIS

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS
  • ArcGIS Developer
  • ArcGIS Solutions
  • ArcGIS Marketplace

Esri について

  • 会社概要
  • 採用情報
  • Esri ブログ
  • ユーザ カンファレンス
  • デベロッパ サミット
Esri
ご意見・ご感想をお寄せください。
Copyright © 2021 Esri. | プライバシー | リーガル