语法
AddMessage (message)
参数 | 说明 | 数据类型 |
message | The informative message. | String |
代码示例
向 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))