GetMessages

摘要

按指定的严重性级别从工具返回地理处理消息。

语法

GetMessages ({severity})
参数说明数据类型
severity

Specifies the type of messages to be returned.

  • 0Informative, warning, and error messages are returned.
  • 1Only warning messages are returned.
  • 2Only error messages are returned.

Not specifying a severity level will return all types of messages.

(默认值为 0)

Integer
返回值
数据类型说明
String

多个地理处理工具消息由换行符 ('\n') 分隔。

代码示例

GetMessages 示例

返回地理处理消息。

import arcpy

fc = arcpy.GetParameterAsText(0)
arcpy.GetCount_management(fc)

# Print all of the geoprocessing messages returned by the
#  last tool (GetCount)
print(arcpy.GetMessages())

相关主题