HOW TO
In ArcGIS Pro, the result of any geoprocessing tool is a result object. Result objects store information about the tool's execution, including messages, parameters and outputs. To access this information from the result object, we can use different methods as described below.
For example, we use the arcpy.management.GetCount function to return the count of records in a feature class and store it in a variable named result, as follows:
result = arcpy.management.GetCount(r"D:\TemplateData\TemplateData.gdb\USA\cities")
The output, per the ArcGIS Pro Geoprocessing Tool Reference, should be of the Long data type (integer value). However, upon printing the type of the result output, we observe that the output mentions a “result class”, as shown below.
print(type(result)) <class 'arcpy.arcobjects.arcobjects.Result'>
Therefore, to access the result outputs, we can use the methods below that provide the required value as a string:
result.getOutput(0)
'3149'
result[0]
'3149'
result.getOutput(“row_count”)
'3149'
result[“row_count”]
'3149'
Similarly, to acquire information about the messages, we can use the getAllMessages method as described below, which returns the required information as a list:
result.getAllMessages()
[[2, 0, 'Start time: 30 June 2025 15:51:41'], [0, 0, 'Row count = 3149'], [3, 0, 'Succeeded at 30 June 2025 15:51:41 (Elapsed Time: 0.09 seconds]]
Article ID: 000036877
Get help from ArcGIS experts
Start chatting now