AddMessage

此 ArcGIS 3.1 文档已 存档,并且不再对其进行更新。 其中的内容和链接可能已过期。 请参阅最新文档

摘要

向脚本工具或 Python 工具箱工具的消息中添加信息性消息(严重性为 0)。

运行工具时,可以从地理处理窗格、地理处理历史记录以及从 Python 调用工具时的消息列表中访问信息性消息。

语法

AddMessage (message)
参数说明数据类型
message

The informative message.

String

代码示例

AddMessage 示例

Python 脚本工具添加信息性消息。

import arcpy

fc = arcpy.GetParameterAsText(0)

# Get the count from GetCount's Result object
feature_count = int(arcpy.GetCount_management(fc).getOutput(0))

if feature_count == 0:
    arcpy.AddError("{0} has no features.".format(fc))
else:
    arcpy.AddMessage("{0} has {1} features.".format(fc, feature_count))

相关主题