ArcGIS Desktop

  • 文档
  • 支持

  • My Profile
  • 帮助
  • Sign Out
ArcGIS Desktop

ArcGIS Online

专为贵组织打造的制图平台

ArcGIS Desktop

全面的专业性 GIS

ArcGIS Enterprise

面向企业的 GIS

ArcGIS for Developers

用于构建位置感知应用程序的工具

ArcGIS Solutions

适用于行业的免费模板地图和应用程序

ArcGIS Marketplace

获取适用于组织的应用程序和数据

  • 文档
  • 支持
Esri
  • 登录
user
  • 我的个人资料
  • 登出

ArcMap

  • 主页
  • 入门
  • 地图
  • 分析
  • 管理数据
  • 工具
  • 扩展模块

列出工具、工具箱及环境设置

根据可用的工具箱,ArcPy 可以访问多个工具箱、大量的环境设置以及众多的工具。ArcPy 具有几个恰当命名的函数,可用来返回工具 (ListTools)、环境设置 (ListEnvironments) 或工具箱 (ListToolboxes) 的列表。

每个函数都具有一个通配符选项,并且能返回一组可循环遍历的名称字符串。以下示例显示了如何访问可用的工具并打印输出其用法。

import arcpy

# Create a list of the conversion tools
#
tools = arcpy.ListTools("*_conversion")

# Loop through the list and print each tool's usage
#
for tool in tools:
    print(arcpy.Usage(tool))

以下示例提供了一种使用 Python 查看环境设置的方法。

import arcpy

environments = arcpy.ListEnvironments()

# Sort the environment list, disregarding capitalization
#
environments.sort(key=str.lower)

for environment in environments:
    # As the environment is passed as a variable, use Python's getattr 
    #   to evaluate the environment's value
    #
    env_value = getattr(arcpy.env, environment)

    # Format and print each environment and its current setting
    #
    print("{0:<30}: {1}".format(environment, env_value))

以下示例提供了一种使用 Python 查看当前工具箱的方法。

import arcpy 

# Print all current toolboxes
#   
for toolbox in arcpy.ListToolboxes():
    # Toolboxes are printed in the form of "toolbox_name(toolbox_alias)"
    print(toolbox)

相关主题

  • 创建数据列表

ArcGIS Desktop

  • 主页
  • 文档
  • 支持

ArcGIS 平台

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

关于 Esri

  • 关于我们
  • 招贤纳士
  • 内部人员博客
  • 用户大会
  • 开发者峰会
Esri
分享您的想法。
Copyright © 2018 Esri. | 隐私政策 | 法律声明